├── .idea
├── PHP-ML-study.iml
├── encodings.xml
├── modules.xml
├── php.xml
├── vcs.xml
└── workspace.xml
├── README.md
├── composer.json
├── composer.lock
├── data
├── for_php_test.csv
├── for_php_train.csv
├── languages.csv
└── train.csv
├── doc
├── Apriori.md
├── CART.md
├── CM.md
├── Cross.md
├── DBSCAN.md
├── MLP.md
├── Nb.md
├── SVR.md
└── clustering.md
├── practice
├── ConfusionMatrix.php
├── Dbscan.php
├── Imputation.php
├── Iris.php
├── Knn.php
├── MLP.php
├── MP.php
├── Matrix.php
├── RandomSpilt.php
├── RandomSplit.php
├── StratifiedRandomSplit.php
├── TfIdfTransformer.php
├── TokenCountVectorizer.php
├── apriori.php
├── car_price.php
├── cart.php
├── cate.php
├── demo.php
├── euclidean.php
├── kmeans.php
├── language-simple.php
├── language.php
├── mlpclassifier.php
├── nb.php
├── pepeline.php
├── pic_classify
│ ├── .idea
│ │ ├── modules.xml
│ │ ├── pic_classify.iml
│ │ └── workspace.xml
│ ├── classify.php
│ ├── common
│ │ └── helper.php
│ ├── composer.json
│ ├── composer.lock
│ ├── processing_pic.php
│ ├── testImages
│ │ ├── cats
│ │ │ └── 1.jpg
│ │ └── person
│ │ │ ├── 1.jpg
│ │ │ └── 2.jpg
│ └── vendor
│ │ ├── autoload.php
│ │ ├── composer
│ │ ├── ClassLoader.php
│ │ ├── LICENSE
│ │ ├── autoload_classmap.php
│ │ ├── autoload_files.php
│ │ ├── autoload_namespaces.php
│ │ ├── autoload_psr4.php
│ │ ├── autoload_real.php
│ │ ├── autoload_static.php
│ │ └── installed.json
│ │ ├── guzzlehttp
│ │ └── psr7
│ │ │ ├── CHANGELOG.md
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ ├── composer.json
│ │ │ └── src
│ │ │ ├── AppendStream.php
│ │ │ ├── BufferStream.php
│ │ │ ├── CachingStream.php
│ │ │ ├── DroppingStream.php
│ │ │ ├── FnStream.php
│ │ │ ├── InflateStream.php
│ │ │ ├── LazyOpenStream.php
│ │ │ ├── LimitStream.php
│ │ │ ├── MessageTrait.php
│ │ │ ├── MultipartStream.php
│ │ │ ├── NoSeekStream.php
│ │ │ ├── PumpStream.php
│ │ │ ├── Request.php
│ │ │ ├── Response.php
│ │ │ ├── ServerRequest.php
│ │ │ ├── Stream.php
│ │ │ ├── StreamDecoratorTrait.php
│ │ │ ├── StreamWrapper.php
│ │ │ ├── UploadedFile.php
│ │ │ ├── Uri.php
│ │ │ ├── UriNormalizer.php
│ │ │ ├── UriResolver.php
│ │ │ ├── functions.php
│ │ │ └── functions_include.php
│ │ ├── intervention
│ │ └── image
│ │ │ ├── LICENSE
│ │ │ ├── composer.json
│ │ │ ├── provides.json
│ │ │ └── src
│ │ │ ├── Intervention
│ │ │ └── Image
│ │ │ │ ├── AbstractColor.php
│ │ │ │ ├── AbstractDecoder.php
│ │ │ │ ├── AbstractDriver.php
│ │ │ │ ├── AbstractEncoder.php
│ │ │ │ ├── AbstractFont.php
│ │ │ │ ├── AbstractShape.php
│ │ │ │ ├── Commands
│ │ │ │ ├── AbstractCommand.php
│ │ │ │ ├── Argument.php
│ │ │ │ ├── ChecksumCommand.php
│ │ │ │ ├── CircleCommand.php
│ │ │ │ ├── EllipseCommand.php
│ │ │ │ ├── ExifCommand.php
│ │ │ │ ├── IptcCommand.php
│ │ │ │ ├── LineCommand.php
│ │ │ │ ├── OrientateCommand.php
│ │ │ │ ├── PolygonCommand.php
│ │ │ │ ├── PsrResponseCommand.php
│ │ │ │ ├── RectangleCommand.php
│ │ │ │ ├── ResponseCommand.php
│ │ │ │ ├── StreamCommand.php
│ │ │ │ └── TextCommand.php
│ │ │ │ ├── Constraint.php
│ │ │ │ ├── Exception
│ │ │ │ ├── ImageException.php
│ │ │ │ ├── InvalidArgumentException.php
│ │ │ │ ├── MissingDependencyException.php
│ │ │ │ ├── NotFoundException.php
│ │ │ │ ├── NotReadableException.php
│ │ │ │ ├── NotSupportedException.php
│ │ │ │ ├── NotWritableException.php
│ │ │ │ └── RuntimeException.php
│ │ │ │ ├── Facades
│ │ │ │ └── Image.php
│ │ │ │ ├── File.php
│ │ │ │ ├── Filters
│ │ │ │ ├── DemoFilter.php
│ │ │ │ └── FilterInterface.php
│ │ │ │ ├── Gd
│ │ │ │ ├── Color.php
│ │ │ │ ├── Commands
│ │ │ │ │ ├── BackupCommand.php
│ │ │ │ │ ├── BlurCommand.php
│ │ │ │ │ ├── BrightnessCommand.php
│ │ │ │ │ ├── ColorizeCommand.php
│ │ │ │ │ ├── ContrastCommand.php
│ │ │ │ │ ├── CropCommand.php
│ │ │ │ │ ├── DestroyCommand.php
│ │ │ │ │ ├── FillCommand.php
│ │ │ │ │ ├── FitCommand.php
│ │ │ │ │ ├── FlipCommand.php
│ │ │ │ │ ├── GammaCommand.php
│ │ │ │ │ ├── GetSizeCommand.php
│ │ │ │ │ ├── GreyscaleCommand.php
│ │ │ │ │ ├── HeightenCommand.php
│ │ │ │ │ ├── InsertCommand.php
│ │ │ │ │ ├── InterlaceCommand.php
│ │ │ │ │ ├── InvertCommand.php
│ │ │ │ │ ├── LimitColorsCommand.php
│ │ │ │ │ ├── MaskCommand.php
│ │ │ │ │ ├── OpacityCommand.php
│ │ │ │ │ ├── PickColorCommand.php
│ │ │ │ │ ├── PixelCommand.php
│ │ │ │ │ ├── PixelateCommand.php
│ │ │ │ │ ├── ResetCommand.php
│ │ │ │ │ ├── ResizeCanvasCommand.php
│ │ │ │ │ ├── ResizeCommand.php
│ │ │ │ │ ├── RotateCommand.php
│ │ │ │ │ ├── SharpenCommand.php
│ │ │ │ │ ├── TrimCommand.php
│ │ │ │ │ └── WidenCommand.php
│ │ │ │ ├── Decoder.php
│ │ │ │ ├── Driver.php
│ │ │ │ ├── Encoder.php
│ │ │ │ ├── Font.php
│ │ │ │ └── Shapes
│ │ │ │ │ ├── CircleShape.php
│ │ │ │ │ ├── EllipseShape.php
│ │ │ │ │ ├── LineShape.php
│ │ │ │ │ ├── PolygonShape.php
│ │ │ │ │ └── RectangleShape.php
│ │ │ │ ├── Image.php
│ │ │ │ ├── ImageManager.php
│ │ │ │ ├── ImageManagerStatic.php
│ │ │ │ ├── ImageServiceProvider.php
│ │ │ │ ├── ImageServiceProviderLaravel4.php
│ │ │ │ ├── ImageServiceProviderLaravel5.php
│ │ │ │ ├── ImageServiceProviderLeague.php
│ │ │ │ ├── ImageServiceProviderLumen.php
│ │ │ │ ├── Imagick
│ │ │ │ ├── Color.php
│ │ │ │ ├── Commands
│ │ │ │ │ ├── BackupCommand.php
│ │ │ │ │ ├── BlurCommand.php
│ │ │ │ │ ├── BrightnessCommand.php
│ │ │ │ │ ├── ColorizeCommand.php
│ │ │ │ │ ├── ContrastCommand.php
│ │ │ │ │ ├── CropCommand.php
│ │ │ │ │ ├── DestroyCommand.php
│ │ │ │ │ ├── ExifCommand.php
│ │ │ │ │ ├── FillCommand.php
│ │ │ │ │ ├── FitCommand.php
│ │ │ │ │ ├── FlipCommand.php
│ │ │ │ │ ├── GammaCommand.php
│ │ │ │ │ ├── GetSizeCommand.php
│ │ │ │ │ ├── GreyscaleCommand.php
│ │ │ │ │ ├── HeightenCommand.php
│ │ │ │ │ ├── InsertCommand.php
│ │ │ │ │ ├── InterlaceCommand.php
│ │ │ │ │ ├── InvertCommand.php
│ │ │ │ │ ├── LimitColorsCommand.php
│ │ │ │ │ ├── MaskCommand.php
│ │ │ │ │ ├── OpacityCommand.php
│ │ │ │ │ ├── PickColorCommand.php
│ │ │ │ │ ├── PixelCommand.php
│ │ │ │ │ ├── PixelateCommand.php
│ │ │ │ │ ├── ResetCommand.php
│ │ │ │ │ ├── ResizeCanvasCommand.php
│ │ │ │ │ ├── ResizeCommand.php
│ │ │ │ │ ├── RotateCommand.php
│ │ │ │ │ ├── SharpenCommand.php
│ │ │ │ │ ├── TrimCommand.php
│ │ │ │ │ └── WidenCommand.php
│ │ │ │ ├── Decoder.php
│ │ │ │ ├── Driver.php
│ │ │ │ ├── Encoder.php
│ │ │ │ ├── Font.php
│ │ │ │ └── Shapes
│ │ │ │ │ ├── CircleShape.php
│ │ │ │ │ ├── EllipseShape.php
│ │ │ │ │ ├── LineShape.php
│ │ │ │ │ ├── PolygonShape.php
│ │ │ │ │ └── RectangleShape.php
│ │ │ │ ├── Point.php
│ │ │ │ ├── Response.php
│ │ │ │ └── Size.php
│ │ │ └── config
│ │ │ └── config.php
│ │ ├── league
│ │ └── glide
│ │ │ ├── .gitattributes
│ │ │ ├── .gitignore
│ │ │ ├── .scrutinizer.yml
│ │ │ ├── .travis.yml
│ │ │ ├── CHANGELOG.md
│ │ │ ├── CONTRIBUTING.md
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ ├── composer.json
│ │ │ ├── composer.lock
│ │ │ ├── docs
│ │ │ ├── 0.3
│ │ │ │ ├── _data
│ │ │ │ │ └── project.yml
│ │ │ │ ├── api
│ │ │ │ │ ├── adjustments.md
│ │ │ │ │ ├── effects.md
│ │ │ │ │ ├── output.md
│ │ │ │ │ └── size.md
│ │ │ │ ├── changelog.md
│ │ │ │ ├── config
│ │ │ │ │ ├── base-url.md
│ │ │ │ │ ├── basic-usage.md
│ │ │ │ │ ├── image-driver.md
│ │ │ │ │ ├── max-image-size.md
│ │ │ │ │ ├── secure-images.md
│ │ │ │ │ ├── source-and-cache.md
│ │ │ │ │ └── the-server.md
│ │ │ │ ├── index.md
│ │ │ │ ├── installation.md
│ │ │ │ └── simple-example.md
│ │ │ ├── 1.0
│ │ │ │ ├── api
│ │ │ │ │ ├── adjustments.md
│ │ │ │ │ ├── background.md
│ │ │ │ │ ├── border.md
│ │ │ │ │ ├── colors.md
│ │ │ │ │ ├── crop.md
│ │ │ │ │ ├── effects.md
│ │ │ │ │ ├── encode.md
│ │ │ │ │ ├── flip.md
│ │ │ │ │ ├── orientation.md
│ │ │ │ │ ├── pixel-density.md
│ │ │ │ │ ├── quick-reference.md
│ │ │ │ │ ├── relative-dimensions.md
│ │ │ │ │ ├── size.md
│ │ │ │ │ └── watermarks.md
│ │ │ │ ├── changelog.md
│ │ │ │ ├── config
│ │ │ │ │ ├── advanced-usage.md
│ │ │ │ │ ├── defaults-and-presets.md
│ │ │ │ │ ├── image-driver.md
│ │ │ │ │ ├── integrations
│ │ │ │ │ │ ├── cakephp.md
│ │ │ │ │ │ ├── laravel.md
│ │ │ │ │ │ ├── psr-7.md
│ │ │ │ │ │ ├── slim.md
│ │ │ │ │ │ ├── symfony.md
│ │ │ │ │ │ └── zend.md
│ │ │ │ │ ├── responses.md
│ │ │ │ │ ├── security.md
│ │ │ │ │ ├── setup.md
│ │ │ │ │ └── source-and-cache.md
│ │ │ │ ├── index.md
│ │ │ │ ├── installation.md
│ │ │ │ ├── screencasts.md
│ │ │ │ └── simple-example.md
│ │ │ ├── CNAME
│ │ │ ├── _config.yml
│ │ │ ├── _data
│ │ │ │ ├── images.yml
│ │ │ │ ├── menu.yml
│ │ │ │ └── project.yml
│ │ │ ├── _layouts
│ │ │ │ └── default.html
│ │ │ ├── apple-touch-icon-precomposed.png
│ │ │ ├── custom.css
│ │ │ ├── custom.js
│ │ │ ├── favicon.ico
│ │ │ └── logo.png
│ │ │ ├── phpunit.xml.dist
│ │ │ ├── src
│ │ │ ├── Api
│ │ │ │ ├── Api.php
│ │ │ │ └── ApiInterface.php
│ │ │ ├── Filesystem
│ │ │ │ ├── FileNotFoundException.php
│ │ │ │ └── FilesystemException.php
│ │ │ ├── Manipulators
│ │ │ │ ├── Background.php
│ │ │ │ ├── BaseManipulator.php
│ │ │ │ ├── Blur.php
│ │ │ │ ├── Border.php
│ │ │ │ ├── Brightness.php
│ │ │ │ ├── Contrast.php
│ │ │ │ ├── Crop.php
│ │ │ │ ├── Encode.php
│ │ │ │ ├── Filter.php
│ │ │ │ ├── Flip.php
│ │ │ │ ├── Gamma.php
│ │ │ │ ├── Helpers
│ │ │ │ │ ├── Color.php
│ │ │ │ │ └── Dimension.php
│ │ │ │ ├── ManipulatorInterface.php
│ │ │ │ ├── Orientation.php
│ │ │ │ ├── Pixelate.php
│ │ │ │ ├── Sharpen.php
│ │ │ │ ├── Size.php
│ │ │ │ └── Watermark.php
│ │ │ ├── Responses
│ │ │ │ ├── PsrResponseFactory.php
│ │ │ │ └── ResponseFactoryInterface.php
│ │ │ ├── Server.php
│ │ │ ├── ServerFactory.php
│ │ │ ├── Signatures
│ │ │ │ ├── Signature.php
│ │ │ │ ├── SignatureException.php
│ │ │ │ ├── SignatureFactory.php
│ │ │ │ └── SignatureInterface.php
│ │ │ └── Urls
│ │ │ │ ├── UrlBuilder.php
│ │ │ │ └── UrlBuilderFactory.php
│ │ │ └── tests
│ │ │ ├── Api
│ │ │ └── ApiTest.php
│ │ │ ├── Manipulators
│ │ │ ├── BackgroundTest.php
│ │ │ ├── BlurTest.php
│ │ │ ├── BorderTest.php
│ │ │ ├── BrightnessTest.php
│ │ │ ├── ContrastTest.php
│ │ │ ├── CropTest.php
│ │ │ ├── EncodeTest.php
│ │ │ ├── FilterTest.php
│ │ │ ├── FlipTest.php
│ │ │ ├── GammaTest.php
│ │ │ ├── Helpers
│ │ │ │ ├── ColorTest.php
│ │ │ │ └── DimensionTest.php
│ │ │ ├── OrientationTest.php
│ │ │ ├── PixelateTest.php
│ │ │ ├── SharpenTest.php
│ │ │ ├── SizeTest.php
│ │ │ └── WatermarkTest.php
│ │ │ ├── Responses
│ │ │ └── PsrResponseFactoryTest.php
│ │ │ ├── ServerFactoryTest.php
│ │ │ ├── ServerTest.php
│ │ │ ├── Signatures
│ │ │ ├── SignatureFactoryTest.php
│ │ │ └── SignatureTest.php
│ │ │ └── Urls
│ │ │ ├── UrlBuilderFactoryTest.php
│ │ │ └── UrlBuilderTest.php
│ │ ├── nancheng
│ │ └── pfinal-array
│ │ │ ├── .idea
│ │ │ ├── copyright
│ │ │ │ └── profiles_settings.xml
│ │ │ ├── dictionaries
│ │ │ │ └── qiuzi.xml
│ │ │ ├── encodings.xml
│ │ │ ├── inspectionProfiles
│ │ │ │ ├── Project_Default.xml
│ │ │ │ └── profiles_settings.xml
│ │ │ ├── misc.xml
│ │ │ ├── modules.xml
│ │ │ ├── pfinal-array.iml
│ │ │ ├── php.xml
│ │ │ ├── vcs.xml
│ │ │ └── workspace.xml
│ │ │ ├── README.md
│ │ │ ├── composer.json
│ │ │ ├── example
│ │ │ └── arrayTest.php
│ │ │ └── src
│ │ │ ├── PFarr.php
│ │ │ └── build
│ │ │ ├── Base.php
│ │ │ ├── PFArrFormat.php
│ │ │ └── PFArrToCsv.php
│ │ ├── psr
│ │ ├── http-message
│ │ │ ├── CHANGELOG.md
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ ├── composer.json
│ │ │ └── src
│ │ │ │ ├── MessageInterface.php
│ │ │ │ ├── RequestInterface.php
│ │ │ │ ├── ResponseInterface.php
│ │ │ │ ├── ServerRequestInterface.php
│ │ │ │ ├── StreamInterface.php
│ │ │ │ ├── UploadedFileInterface.php
│ │ │ │ └── UriInterface.php
│ │ └── log
│ │ │ ├── .gitignore
│ │ │ ├── LICENSE
│ │ │ ├── Psr
│ │ │ └── Log
│ │ │ │ ├── AbstractLogger.php
│ │ │ │ ├── InvalidArgumentException.php
│ │ │ │ ├── LogLevel.php
│ │ │ │ ├── LoggerAwareInterface.php
│ │ │ │ ├── LoggerAwareTrait.php
│ │ │ │ ├── LoggerInterface.php
│ │ │ │ ├── LoggerTrait.php
│ │ │ │ ├── NullLogger.php
│ │ │ │ └── Test
│ │ │ │ └── LoggerInterfaceTest.php
│ │ │ ├── README.md
│ │ │ └── composer.json
│ │ ├── spatie
│ │ ├── image
│ │ │ ├── .editorconfig
│ │ │ ├── .styleci.yml
│ │ │ ├── CHANGELOG.md
│ │ │ ├── CONTRIBUTING.md
│ │ │ ├── LICENSE.md
│ │ │ ├── README.md
│ │ │ ├── composer.json
│ │ │ └── src
│ │ │ │ ├── Exceptions
│ │ │ │ ├── CouldNotConvert.php
│ │ │ │ ├── InvalidImageDriver.php
│ │ │ │ └── InvalidManipulation.php
│ │ │ │ ├── GlideConversion.php
│ │ │ │ ├── Image.php
│ │ │ │ ├── ManipulationSequence.php
│ │ │ │ └── Manipulations.php
│ │ └── temporary-directory
│ │ │ ├── CHANGELOG.md
│ │ │ ├── CONTRIBUTING.md
│ │ │ ├── LICENSE.md
│ │ │ ├── README.md
│ │ │ ├── composer.json
│ │ │ └── src
│ │ │ └── TemporaryDirectory.php
│ │ └── symfony
│ │ └── process
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── Exception
│ │ ├── ExceptionInterface.php
│ │ ├── InvalidArgumentException.php
│ │ ├── LogicException.php
│ │ ├── ProcessFailedException.php
│ │ ├── ProcessTimedOutException.php
│ │ └── RuntimeException.php
│ │ ├── ExecutableFinder.php
│ │ ├── InputStream.php
│ │ ├── LICENSE
│ │ ├── PhpExecutableFinder.php
│ │ ├── PhpProcess.php
│ │ ├── Pipes
│ │ ├── AbstractPipes.php
│ │ ├── PipesInterface.php
│ │ ├── UnixPipes.php
│ │ └── WindowsPipes.php
│ │ ├── Process.php
│ │ ├── ProcessBuilder.php
│ │ ├── ProcessUtils.php
│ │ ├── README.md
│ │ ├── Tests
│ │ ├── ExecutableFinderTest.php
│ │ ├── NonStopableProcess.php
│ │ ├── PhpExecutableFinderTest.php
│ │ ├── PhpProcessTest.php
│ │ ├── PipeStdinInStdoutStdErrStreamSelect.php
│ │ ├── ProcessBuilderTest.php
│ │ ├── ProcessFailedExceptionTest.php
│ │ ├── ProcessTest.php
│ │ ├── ProcessUtilsTest.php
│ │ └── SignalListener.php
│ │ ├── composer.json
│ │ └── phpunit.xml.dist
├── pipeline.php
├── stock.php
├── svc.php
├── svr.php
├── svr1.php
├── write.csv
└── write.php
└── vendor
├── autoload.php
├── composer
├── ClassLoader.php
├── LICENSE
├── autoload_classmap.php
├── autoload_namespaces.php
├── autoload_psr4.php
├── autoload_real.php
├── autoload_static.php
└── installed.json
└── nancheng
└── pfinal-array
├── .idea
├── copyright
│ └── profiles_settings.xml
├── dictionaries
│ └── qiuzi.xml
├── encodings.xml
├── inspectionProfiles
│ ├── Project_Default.xml
│ └── profiles_settings.xml
├── misc.xml
├── modules.xml
├── pfinal-array.iml
├── php.xml
├── vcs.xml
└── workspace.xml
├── README.md
├── composer.json
├── example
└── arrayTest.php
└── src
├── PFarr.php
└── build
├── Base.php
├── PFArrFormat.php
└── PFArrToCsv.php
/.idea/PHP-ML-study.iml:
--------------------------------------------------------------------------------
1 |
2 |
'; 26 | print_r($dataset_demp->getTestSamples()); //测试的数据 27 | print_r($dataset_demp->getTestLabels()); //测试的标记 28 | 29 | -------------------------------------------------------------------------------- /practice/RandomSplit.php: -------------------------------------------------------------------------------- 1 | getTrainSamples()); 13 | PFarr::dd($randomSplit->getTestSamples()); -------------------------------------------------------------------------------- /practice/StratifiedRandomSplit.php: -------------------------------------------------------------------------------- 1 | '; 19 | //print_r($split->getTrainSamples()); //训练的数据 20 | //print_r($split->getTrainLabels()); //训练的标记 21 | 22 | //随机取得测试数据 23 | echo ''; 24 | //print_r($split->getTestSamples()); //测试的数据 25 | //print_r($split->getTestLabels()); //测试的标记 26 | 27 | $regression = new SVR(Kernel::RBF, 3, 0.1, 10); 28 | $regression->train($split->getTrainSamples(), $split->getTrainLabels()); 29 | $predicted = $regression->predict($split->getTestSamples()); 30 | 31 | foreach ($predicted as &$target) { 32 | $target = round($target, 0); 33 | } 34 | echo 'Accuracy: ' . Accuracy::score($split->getTestLabels(), $predicted); -------------------------------------------------------------------------------- /practice/TfIdfTransformer.php: -------------------------------------------------------------------------------- 1 | 1, 1 => 1, 2 => 2, 3 => 1, 4 => 0, 5 => 0], 13 | [0 => 1, 1 => 1, 2 => 0, 3 => 0, 4 => 2, 5 => 3], 14 | ]; 15 | 16 | 17 | $transformer = new TfIdfTransformer($samples); 18 | $transformer->transform($samples); 19 | PFarr::dd($samples); 20 | -------------------------------------------------------------------------------- /practice/TokenCountVectorizer.php: -------------------------------------------------------------------------------- 1 | transform($samples); 17 | 18 | PFarr::dd($samples); -------------------------------------------------------------------------------- /practice/apriori.php: -------------------------------------------------------------------------------- 1 | train($samples, $labels); 33 | /** 34 | * 假如顾客 购买了辣条 推荐用户的商品有 35 | */ 36 | PFarr::dd($associator->predict(['猫粮'])); -------------------------------------------------------------------------------- /practice/car_price.php: -------------------------------------------------------------------------------- 1 | train($samples, $targets); 18 | //预测60000公里的车 在2018年 的价格 19 | $arr = $regression->predict([60000, 2018]); 20 | PFarr::dd($arr); 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /practice/cart.php: -------------------------------------------------------------------------------- 1 | train($database->getSamples(),$database->getTargets()); 13 | $res = $cart->predict([[1,0],[0,3],[3,1]]); 14 | 15 | $report = new ClassificationReport($database->getTargets(), $res); 16 | PFarr::dd($report->getPrecision()); -------------------------------------------------------------------------------- /practice/cate.php: -------------------------------------------------------------------------------- 1 | train($samples, $labels); 17 | $data = $nb->predict([['food']]); 18 | PFarr::dd($data); 19 | -------------------------------------------------------------------------------- /practice/demo.php: -------------------------------------------------------------------------------- 1 | train($samples, $labels); 24 | 25 | //预测样本标签使用 predict 方法。 26 | $arr = $associator1->predict(['alpha', 'beta', 'theta']); 27 | //var_dump($arr); 28 | 29 | //生成关联规则简单地使用 rules 方法。 30 | $arr1 = $associator->getRules(); 31 | var_dump($arr1); 32 | 33 | //生成k-length频繁项集简单地使用 apriori 方法。 34 | 35 | var_dump($associator->apriori()); 36 | -------------------------------------------------------------------------------- /practice/euclidean.php: -------------------------------------------------------------------------------- 1 | '; 9 | /** 10 | * 欧几里德距离 11 | */ 12 | $a = [4, 6]; 13 | $b = [2, 5]; 14 | 15 | $euclidean = new Euclidean(); 16 | $data = $euclidean->distance($a, $b); 17 | echo $data.'
'; 18 | // return 2.2360679774998 19 | 20 | 21 | /** 22 | * 曼哈顿距离 23 | */ 24 | $a1 = [4, 6]; 25 | $b1 = [2, 5]; 26 | 27 | $manhattan = new Manhattan(); 28 | $data_a = $manhattan->distance($a1, $b1); 29 | 30 | echo $data_a.'
'; 31 | 32 | /** 33 | * 切夫雪比距离 34 | */ 35 | 36 | $a2 = [4, 6]; 37 | $b2 = [2, 5]; 38 | 39 | $chebyshev = new Chebyshev(); 40 | $data_b = $chebyshev->distance($a2, $b2); 41 | 42 | echo $data_b.'
'; 43 | // return 2 44 | 45 | /** 46 | * 闵可夫斯基距离 47 | */ 48 | 49 | $a3 = [4, 6]; 50 | $b3 = [2, 5]; 51 | 52 | $chebyshev = new Minkowski(); 53 | $data_c = $chebyshev->distance($a3, $b3); 54 | 55 | echo $data_c.'
'; 56 | 57 | /** 58 | * 闵可夫斯基距离 - 带参数 59 | */ 60 | $a4 = [6, 10, 3]; 61 | $b4 = [2, 5, 5]; 62 | 63 | $minkowski = new Minkowski($lambda = 5); 64 | $data_d =$minkowski->distance($a4, $b4); 65 | 66 | echo $data_d.'
'; -------------------------------------------------------------------------------- /practice/kmeans.php: -------------------------------------------------------------------------------- 1 | cluster($samples)); -------------------------------------------------------------------------------- /practice/language-simple.php: -------------------------------------------------------------------------------- 1 | fit($samples); 31 | $vectorizer->transform($samples); 32 | 33 | $transformer = new TfIdfTransformer($samples); 34 | $transformer->fit($samples); 35 | $transformer->transform($samples); 36 | 37 | $dataset = new ArrayDataset($samples, $labels); 38 | $classifier = new SVC(Kernel::RBF, 10000); 39 | $classifier->train($samples,$labels); 40 | 41 | 42 | $testData = ['中']; 43 | 44 | $vectorizer->fit($testData); 45 | $vectorizer->transform($testData); 46 | 47 | PFarr::dd($classifier->predict($testData)); -------------------------------------------------------------------------------- /practice/language.php: -------------------------------------------------------------------------------- 1 | getSamples() as $sample) { 24 | $samples[] = $sample[0]; 25 | } 26 | 27 | $vectorizer->fit($samples); 28 | $vectorizer->transform($samples); 29 | $tfIdfTransformer->fit($samples); 30 | $tfIdfTransformer->transform($samples); 31 | 32 | $dataset = new ArrayDataset($samples, $dataset->getTargets()); 33 | 34 | $randomSplit = new StratifiedRandomSplit($dataset, 0.1); //样本分类 35 | 36 | $classifier = new SVC(Kernel::RBF, 10000); 37 | 38 | $classifier->train($randomSplit->getTrainSamples(), $randomSplit->getTrainLabels()); 39 | $testpredictedLabels = $classifier->predict($randomSplit->getTestSamples()); 40 | print_r($testpredictedLabels);// return Array ( [0] => zh ) 41 | exit; -------------------------------------------------------------------------------- /practice/mlpclassifier.php: -------------------------------------------------------------------------------- 1 | getTrainSamples()); 16 | $mlp->train( 17 | $samples = $castTrainSamples, 18 | $targets = $split->getTrainLabels() 19 | ); 20 | $castTestSamples = cast($split->getTestSamples()); 21 | $predicted = $mlp->predict($castTestSamples); 22 | var_dump(Accuracy::score($split->getTestLabels(), $predicted)); 23 | function cast($data) { 24 | foreach ($data as $k => $v) { 25 | foreach ($v as $k2 => $s) { 26 | $float = (float) $s; 27 | $data[$k][$k2] = $float; 28 | } 29 | } 30 | return $data; 31 | } -------------------------------------------------------------------------------- /practice/nb.php: -------------------------------------------------------------------------------- 1 | train($samples, $labels); 17 | print_r($classifier->predict([[172,40]])); 18 | // return [-1, 1] 代表女生、男生 19 | exit; -------------------------------------------------------------------------------- /practice/pepeline.php: -------------------------------------------------------------------------------- 1 | train($samples, $targets); 31 | 32 | $predicted = $pipeline->predict([[0, 0, 0]]); 33 | PFarr::dd($predicted); -------------------------------------------------------------------------------- /practice/pic_classify/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 |3 | -------------------------------------------------------------------------------- /practice/pic_classify/.idea/pic_classify.iml: -------------------------------------------------------------------------------- 1 | 2 |4 | 8 |5 | 7 |6 | 3 | -------------------------------------------------------------------------------- /practice/pic_classify/classify.php: -------------------------------------------------------------------------------- 1 | _/___.' >'"". 23 | * | | : `- \`.;`\ _ /`;.`/ - ` : | | 24 | * \ \ `-. \_ __\ /__ _/ .-` / / 25 | * ========`-.____`-.___\_____/___.-`____.-'======== 26 | * `=---=' 27 | * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 28 | * 佛祖保佑 永无BUG 永不修改 29 | * 30 | */ 31 | 32 | require __DIR__.'/vendor/autoload.php'; 33 | 34 | -------------------------------------------------------------------------------- /practice/pic_classify/common/helper.php: -------------------------------------------------------------------------------- 1 | _/___.' >'"". 23 | * | | : `- \`.;`\ _ /`;.`/ - ` : | | 24 | * \ \ `-. \_ __\ /__ _/ .-` / / 25 | * ========`-.____`-.___\_____/___.-`____.-'======== 26 | * `=---=' 27 | * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 28 | * 佛祖保佑 永无BUG 永不修改 29 | * 30 | */ 31 | 32 | if (!function_exists('dd')) { 33 | function dd($arr) 34 | { 35 | if (function_exists('dump')) { 36 | dump($arr);exit; 37 | } 38 | echo '4 | 8 |5 | 6 | 7 | '; 39 | var_dump($arr); 40 | echo ''; 41 | exit; 42 | } 43 | } -------------------------------------------------------------------------------- /practice/pic_classify/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "spatie/image": "^1.5", 4 | "nancheng/pfinal-array": "^0.2.0" 5 | }, 6 | "autoload":{ 7 | "files":["common/helper.php"] 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /practice/pic_classify/testImages/cats/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmlic/PHP-ML-study/700b10a92e3d45cb794458db6547e73ac9082e2a/practice/pic_classify/testImages/cats/1.jpg -------------------------------------------------------------------------------- /practice/pic_classify/testImages/person/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmlic/PHP-ML-study/700b10a92e3d45cb794458db6547e73ac9082e2a/practice/pic_classify/testImages/person/1.jpg -------------------------------------------------------------------------------- /practice/pic_classify/testImages/person/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmlic/PHP-ML-study/700b10a92e3d45cb794458db6547e73ac9082e2a/practice/pic_classify/testImages/person/2.jpg -------------------------------------------------------------------------------- /practice/pic_classify/vendor/autoload.php: -------------------------------------------------------------------------------- 1 | $vendorDir . '/guzzlehttp/psr7/src/functions_include.php', 10 | 'b0bb28d4fd1217fce1b0755b3211f6a6' => $baseDir . '/common/helper.php', 11 | ); 12 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/composer/autoload_namespaces.php: -------------------------------------------------------------------------------- 1 | array($vendorDir . '/nancheng/pfinal-array/src'), 10 | 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'), 11 | 'Spatie\\TemporaryDirectory\\' => array($vendorDir . '/spatie/temporary-directory/src'), 12 | 'Spatie\\Image\\' => array($vendorDir . '/spatie/image/src'), 13 | 'Spatie\\ImageOptimizer\\' => array($vendorDir . '/spatie/image-optimizer/src'), 14 | 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'), 15 | 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'), 16 | 'League\\Glide\\' => array($vendorDir . '/league/glide/src'), 17 | 'League\\Flysystem\\' => array($vendorDir . '/league/flysystem/src'), 18 | 'Intervention\\Image\\' => array($vendorDir . '/intervention/image/src/Intervention/Image'), 19 | 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'), 20 | ); 21 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/guzzlehttp/psr7/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Michael Dowling, https://github.com/mtdowling2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/guzzlehttp/psr7/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "guzzlehttp/psr7", 3 | "type": "library", 4 | "description": "PSR-7 message implementation that also provides common utility methods", 5 | "keywords": ["request", "response", "message", "stream", "http", "uri", "url"], 6 | "license": "MIT", 7 | "authors": [ 8 | { 9 | "name": "Michael Dowling", 10 | "email": "mtdowling@gmail.com", 11 | "homepage": "https://github.com/mtdowling" 12 | }, 13 | { 14 | "name": "Tobias Schultze", 15 | "homepage": "https://github.com/Tobion" 16 | } 17 | ], 18 | "require": { 19 | "php": ">=5.4.0", 20 | "psr/http-message": "~1.0" 21 | }, 22 | "require-dev": { 23 | "phpunit/phpunit": "~4.0" 24 | }, 25 | "provide": { 26 | "psr/http-message-implementation": "1.0" 27 | }, 28 | "autoload": { 29 | "psr-4": { 30 | "GuzzleHttp\\Psr7\\": "src/" 31 | }, 32 | "files": ["src/functions_include.php"] 33 | }, 34 | "extra": { 35 | "branch-alias": { 36 | "dev-master": "1.4-dev" 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/guzzlehttp/psr7/src/DroppingStream.php: -------------------------------------------------------------------------------- 1 | stream = $stream; 23 | $this->maxLength = $maxLength; 24 | } 25 | 26 | public function write($string) 27 | { 28 | $diff = $this->maxLength - $this->stream->getSize(); 29 | 30 | // Begin returning 0 when the underlying stream is too large. 31 | if ($diff <= 0) { 32 | return 0; 33 | } 34 | 35 | // Write the stream or a subset of the stream if needed. 36 | if (strlen($string) < $diff) { 37 | return $this->stream->write($string); 38 | } 39 | 40 | return $this->stream->write(substr($string, 0, $diff)); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/guzzlehttp/psr7/src/LazyOpenStream.php: -------------------------------------------------------------------------------- 1 | filename = $filename; 27 | $this->mode = $mode; 28 | } 29 | 30 | /** 31 | * Creates the underlying stream lazily when required. 32 | * 33 | * @return StreamInterface 34 | */ 35 | protected function createStream() 36 | { 37 | return stream_for(try_fopen($this->filename, $this->mode)); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/guzzlehttp/psr7/src/NoSeekStream.php: -------------------------------------------------------------------------------- 1 | getSize(); 18 | 19 | for ($x=0; $x <= ($size->width-1); $x++) { 20 | for ($y=0; $y <= ($size->height-1); $y++) { 21 | $colors[] = $image->pickColor($x, $y, 'array'); 22 | } 23 | } 24 | 25 | $this->setOutput(md5(serialize($colors))); 26 | 27 | return true; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Commands/CircleCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->type('numeric')->required()->value(); 18 | $x = $this->argument(1)->type('numeric')->required()->value(); 19 | $y = $this->argument(2)->type('numeric')->required()->value(); 20 | $callback = $this->argument(3)->type('closure')->value(); 21 | 22 | $circle_classname = sprintf('\Intervention\Image\%s\Shapes\CircleShape', 23 | $image->getDriver()->getDriverName()); 24 | 25 | $circle = new $circle_classname($diameter); 26 | 27 | if ($callback instanceof Closure) { 28 | $callback($circle); 29 | } 30 | 31 | $circle->applyToImage($image, $x, $y); 32 | 33 | return true; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Commands/EllipseCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->type('numeric')->required()->value(); 18 | $height = $this->argument(1)->type('numeric')->required()->value(); 19 | $x = $this->argument(2)->type('numeric')->required()->value(); 20 | $y = $this->argument(3)->type('numeric')->required()->value(); 21 | $callback = $this->argument(4)->type('closure')->value(); 22 | 23 | $ellipse_classname = sprintf('\Intervention\Image\%s\Shapes\EllipseShape', 24 | $image->getDriver()->getDriverName()); 25 | 26 | $ellipse = new $ellipse_classname($width, $height); 27 | 28 | if ($callback instanceof Closure) { 29 | $callback($ellipse); 30 | } 31 | 32 | $ellipse->applyToImage($image, $x, $y); 33 | 34 | return true; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Commands/ExifCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->value(); 25 | 26 | // try to read exif data from image file 27 | $data = @exif_read_data($image->dirname .'/'. $image->basename); 28 | 29 | if (! is_null($key) && is_array($data)) { 30 | $data = array_key_exists($key, $data) ? $data[$key] : false; 31 | } 32 | 33 | $this->setOutput($data); 34 | 35 | return true; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Commands/LineCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->type('numeric')->required()->value(); 18 | $y1 = $this->argument(1)->type('numeric')->required()->value(); 19 | $x2 = $this->argument(2)->type('numeric')->required()->value(); 20 | $y2 = $this->argument(3)->type('numeric')->required()->value(); 21 | $callback = $this->argument(4)->type('closure')->value(); 22 | 23 | $line_classname = sprintf('\Intervention\Image\%s\Shapes\LineShape', 24 | $image->getDriver()->getDriverName()); 25 | 26 | $line = new $line_classname($x2, $y2); 27 | 28 | if ($callback instanceof Closure) { 29 | $callback($line); 30 | } 31 | 32 | $line->applyToImage($image, $x1, $y1); 33 | 34 | return true; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Commands/OrientateCommand.php: -------------------------------------------------------------------------------- 1 | exif('Orientation')) { 16 | 17 | case 2: 18 | $image->flip(); 19 | break; 20 | 21 | case 3: 22 | $image->rotate(180); 23 | break; 24 | 25 | case 4: 26 | $image->rotate(180)->flip(); 27 | break; 28 | 29 | case 5: 30 | $image->rotate(270)->flip(); 31 | break; 32 | 33 | case 6: 34 | $image->rotate(270); 35 | break; 36 | 37 | case 7: 38 | $image->rotate(90)->flip(); 39 | break; 40 | 41 | case 8: 42 | $image->rotate(90); 43 | break; 44 | } 45 | 46 | return true; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Commands/RectangleCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->type('numeric')->required()->value(); 18 | $y1 = $this->argument(1)->type('numeric')->required()->value(); 19 | $x2 = $this->argument(2)->type('numeric')->required()->value(); 20 | $y2 = $this->argument(3)->type('numeric')->required()->value(); 21 | $callback = $this->argument(4)->type('closure')->value(); 22 | 23 | $rectangle_classname = sprintf('\Intervention\Image\%s\Shapes\RectangleShape', 24 | $image->getDriver()->getDriverName()); 25 | 26 | $rectangle = new $rectangle_classname($x1, $y1, $x2, $y2); 27 | 28 | if ($callback instanceof Closure) { 29 | $callback($rectangle); 30 | } 31 | 32 | $rectangle->applyToImage($image, $x1, $y1); 33 | 34 | return true; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Commands/ResponseCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->value(); 18 | $quality = $this->argument(1)->between(0, 100)->value(); 19 | 20 | $response = new Response($image, $format, $quality); 21 | 22 | $this->setOutput($response->make()); 23 | 24 | return true; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Commands/StreamCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->value(); 17 | $quality = $this->argument(1)->between(0, 100)->value(); 18 | 19 | $this->setOutput(\GuzzleHttp\Psr7\stream_for( 20 | $image->encode($format, $quality)->getEncoded() 21 | )); 22 | 23 | return true; 24 | } 25 | } -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Commands/TextCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->required()->value(); 17 | $x = $this->argument(1)->type('numeric')->value(0); 18 | $y = $this->argument(2)->type('numeric')->value(0); 19 | $callback = $this->argument(3)->type('closure')->value(); 20 | 21 | $fontclassname = sprintf('\Intervention\Image\%s\Font', 22 | $image->getDriver()->getDriverName()); 23 | 24 | $font = new $fontclassname($text); 25 | 26 | if ($callback instanceof Closure) { 27 | $callback($font); 28 | } 29 | 30 | $font->applyToImage($image, $x, $y); 31 | 32 | return true; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Exception/ImageException.php: -------------------------------------------------------------------------------- 1 | size = is_numeric($size) ? intval($size) : self::DEFAULT_SIZE; 27 | } 28 | 29 | /** 30 | * Applies filter effects to given image 31 | * 32 | * @param \Intervention\Image\Image $image 33 | * @return \Intervention\Image\Image 34 | */ 35 | public function applyFilter(\Intervention\Image\Image $image) 36 | { 37 | $image->pixelate($this->size); 38 | $image->greyscale(); 39 | 40 | return $image; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Filters/FilterInterface.php: -------------------------------------------------------------------------------- 1 | argument(0)->value(); 16 | 17 | // clone current image resource 18 | $clone = clone $image; 19 | $image->setBackup($clone->getCore(), $backupName); 20 | 21 | return true; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BlurCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->between(0, 100)->value(1); 16 | 17 | for ($i=0; $i < intval($amount); $i++) { 18 | imagefilter($image->getCore(), IMG_FILTER_GAUSSIAN_BLUR); 19 | } 20 | 21 | return true; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BrightnessCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->between(-100, 100)->required()->value(); 16 | 17 | return imagefilter($image->getCore(), IMG_FILTER_BRIGHTNESS, ($level * 2.55)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ColorizeCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->between(-100, 100)->required()->value(); 16 | $green = $this->argument(1)->between(-100, 100)->required()->value(); 17 | $blue = $this->argument(2)->between(-100, 100)->required()->value(); 18 | 19 | // normalize colorize levels 20 | $red = round($red * 2.55); 21 | $green = round($green * 2.55); 22 | $blue = round($blue * 2.55); 23 | 24 | // apply filter 25 | return imagefilter($image->getCore(), IMG_FILTER_COLORIZE, $red, $green, $blue); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ContrastCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->between(-100, 100)->required()->value(); 16 | 17 | return imagefilter($image->getCore(), IMG_FILTER_CONTRAST, ($level * -1)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Gd/Commands/DestroyCommand.php: -------------------------------------------------------------------------------- 1 | getCore()); 17 | 18 | // destroy backups 19 | foreach ($image->getBackups() as $backup) { 20 | imagedestroy($backup); 21 | } 22 | 23 | return true; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FitCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->type('digit')->required()->value(); 18 | $height = $this->argument(1)->type('digit')->value($width); 19 | $constraints = $this->argument(2)->type('closure')->value(); 20 | $position = $this->argument(3)->type('string')->value('center'); 21 | 22 | // calculate size 23 | $cropped = $image->getSize()->fit(new Size($width, $height), $position); 24 | $resized = clone $cropped; 25 | $resized = $resized->resize($width, $height, $constraints); 26 | 27 | // modify image 28 | $this->modify($image, 0, 0, $cropped->pivot->x, $cropped->pivot->y, $resized->getWidth(), $resized->getHeight(), $cropped->getWidth(), $cropped->getHeight()); 29 | 30 | return true; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FlipCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->value('h'); 16 | 17 | $size = $image->getSize(); 18 | $dst = clone $size; 19 | 20 | switch (strtolower($mode)) { 21 | case 2: 22 | case 'v': 23 | case 'vert': 24 | case 'vertical': 25 | $size->pivot->y = $size->height - 1; 26 | $size->height = $size->height * (-1); 27 | break; 28 | 29 | default: 30 | $size->pivot->x = $size->width - 1; 31 | $size->width = $size->width * (-1); 32 | break; 33 | } 34 | 35 | return $this->modify($image, 0, 0, $size->pivot->x, $size->pivot->y, $dst->width, $dst->height, $size->width, $size->height); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GammaCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->type('numeric')->required()->value(); 16 | 17 | return imagegammacorrect($image->getCore(), 1, $gamma); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GetSizeCommand.php: -------------------------------------------------------------------------------- 1 | setOutput(new Size( 18 | imagesx($image->getCore()), 19 | imagesy($image->getCore()) 20 | )); 21 | 22 | return true; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GreyscaleCommand.php: -------------------------------------------------------------------------------- 1 | getCore(), IMG_FILTER_GRAYSCALE); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Gd/Commands/HeightenCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->type('digit')->required()->value(); 16 | $additionalConstraints = $this->argument(1)->type('closure')->value(); 17 | 18 | $this->arguments[0] = null; 19 | $this->arguments[1] = $height; 20 | $this->arguments[2] = function ($constraint) use ($additionalConstraints) { 21 | $constraint->aspectRatio(); 22 | if(is_callable($additionalConstraints)) 23 | $additionalConstraints($constraint); 24 | }; 25 | 26 | return parent::execute($image); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InsertCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->required()->value(); 16 | $position = $this->argument(1)->type('string')->value(); 17 | $x = $this->argument(2)->type('digit')->value(0); 18 | $y = $this->argument(3)->type('digit')->value(0); 19 | 20 | // build watermark 21 | $watermark = $image->getDriver()->init($source); 22 | 23 | // define insertion point 24 | $image_size = $image->getSize()->align($position, $x, $y); 25 | $watermark_size = $watermark->getSize()->align($position); 26 | $target = $image_size->relativePosition($watermark_size); 27 | 28 | // insert image at position 29 | imagealphablending($image->getCore(), true); 30 | return imagecopy($image->getCore(), $watermark->getCore(), $target->x, $target->y, 0, 0, $watermark_size->width, $watermark_size->height); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InterlaceCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->type('bool')->value(true); 16 | 17 | imageinterlace($image->getCore(), $mode); 18 | 19 | return true; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InvertCommand.php: -------------------------------------------------------------------------------- 1 | getCore(), IMG_FILTER_NEGATE); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Gd/Commands/OpacityCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->between(0, 100)->required()->value(); 16 | 17 | // get size of image 18 | $size = $image->getSize(); 19 | 20 | // build temp alpha mask 21 | $mask_color = sprintf('rgba(0, 0, 0, %.1F)', $transparency / 100); 22 | $mask = $image->getDriver()->newImage($size->width, $size->height, $mask_color); 23 | 24 | // mask image 25 | $image->mask($mask->getCore(), true); 26 | 27 | return true; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PickColorCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->type('digit')->required()->value(); 18 | $y = $this->argument(1)->type('digit')->required()->value(); 19 | $format = $this->argument(2)->type('string')->value('array'); 20 | 21 | // pick color 22 | $color = imagecolorat($image->getCore(), $x, $y); 23 | 24 | if ( ! imageistruecolor($image->getCore())) { 25 | $color = imagecolorsforindex($image->getCore(), $color); 26 | $color['alpha'] = round(1 - $color['alpha'] / 127, 2); 27 | } 28 | 29 | $color = new Color($color); 30 | 31 | // format to output 32 | $this->setOutput($color->format($format)); 33 | 34 | return true; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PixelCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->required()->value(); 18 | $color = new Color($color); 19 | $x = $this->argument(1)->type('digit')->required()->value(); 20 | $y = $this->argument(2)->type('digit')->required()->value(); 21 | 22 | return imagesetpixel($image->getCore(), $x, $y, $color->getInt()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PixelateCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->type('digit')->value(10); 16 | 17 | return imagefilter($image->getCore(), IMG_FILTER_PIXELATE, $size, true); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResetCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->value(); 16 | 17 | if (is_resource($backup = $image->getBackup($backupName))) { 18 | 19 | // destroy current resource 20 | imagedestroy($image->getCore()); 21 | 22 | // clone backup 23 | $backup = $image->getDriver()->cloneCore($backup); 24 | 25 | // reset to new resource 26 | $image->setCore($backup); 27 | 28 | return true; 29 | } 30 | 31 | throw new \Intervention\Image\Exception\RuntimeException( 32 | "Backup not available. Call backup() before reset()." 33 | ); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Gd/Commands/RotateCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->type('numeric')->required()->value(); 18 | $color = $this->argument(1)->value(); 19 | $color = new Color($color); 20 | 21 | // restrict rotations beyond 360 degrees, since the end result is the same 22 | $angle %= 360; 23 | 24 | // rotate image 25 | $image->setCore(imagerotate($image->getCore(), $angle, $color->getInt())); 26 | 27 | return true; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Gd/Commands/SharpenCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->between(0, 100)->value(10); 16 | 17 | // build matrix 18 | $min = $amount >= 10 ? $amount * -0.01 : 0; 19 | $max = $amount * -0.025; 20 | $abs = ((4 * $min + 4 * $max) * -1) + 1; 21 | $div = 1; 22 | 23 | $matrix = [ 24 | [$min, $max, $min], 25 | [$max, $abs, $max], 26 | [$min, $max, $min] 27 | ]; 28 | 29 | // apply the matrix 30 | return imageconvolution($image->getCore(), $matrix, $div, 0); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Gd/Commands/WidenCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->type('digit')->required()->value(); 16 | $additionalConstraints = $this->argument(1)->type('closure')->value(); 17 | 18 | $this->arguments[0] = $width; 19 | $this->arguments[1] = null; 20 | $this->arguments[2] = function ($constraint) use ($additionalConstraints) { 21 | $constraint->aspectRatio(); 22 | if(is_callable($additionalConstraints)) 23 | $additionalConstraints($constraint); 24 | }; 25 | 26 | return parent::execute($image); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/CircleShape.php: -------------------------------------------------------------------------------- 1 | width = is_numeric($diameter) ? intval($diameter) : $this->diameter; 24 | $this->height = is_numeric($diameter) ? intval($diameter) : $this->diameter; 25 | $this->diameter = is_numeric($diameter) ? intval($diameter) : $this->diameter; 26 | } 27 | 28 | /** 29 | * Draw current circle on given image 30 | * 31 | * @param Image $image 32 | * @param int $x 33 | * @param int $y 34 | * @return boolean 35 | */ 36 | public function applyToImage(Image $image, $x = 0, $y = 0) 37 | { 38 | return parent::applyToImage($image, $x, $y); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/PolygonShape.php: -------------------------------------------------------------------------------- 1 | points = $points; 25 | } 26 | 27 | /** 28 | * Draw polygon on given image 29 | * 30 | * @param Image $image 31 | * @param int $x 32 | * @param int $y 33 | * @return boolean 34 | */ 35 | public function applyToImage(Image $image, $x = 0, $y = 0) 36 | { 37 | $background = new Color($this->background); 38 | imagefilledpolygon($image->getCore(), $this->points, intval(count($this->points) / 2), $background->getInt()); 39 | 40 | if ($this->hasBorder()) { 41 | $border_color = new Color($this->border_color); 42 | imagesetthickness($image->getCore(), $this->border_width); 43 | imagepolygon($image->getCore(), $this->points, intval(count($this->points) / 2), $border_color->getInt()); 44 | } 45 | 46 | return true; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLeague.php: -------------------------------------------------------------------------------- 1 | config = $config; 29 | } 30 | 31 | /** 32 | * Register the server provider. 33 | * 34 | * @return void 35 | */ 36 | public function register() 37 | { 38 | $this->getContainer()->share('Intervention\Image\ImageManager', function () { 39 | return new ImageManager($this->config); 40 | }); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLumen.php: -------------------------------------------------------------------------------- 1 | app; 17 | 18 | // merge default config 19 | $this->mergeConfigFrom( 20 | __DIR__.'/../../config/config.php', 21 | 'image' 22 | ); 23 | 24 | // set configuration 25 | $app->configure('image'); 26 | 27 | // create image 28 | $app->singleton('image',function ($app) { 29 | return new ImageManager($app['config']->get('image')); 30 | }); 31 | 32 | $app->alias('image', 'Intervention\Image\ImageManager'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BackupCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->value(); 16 | 17 | // clone current image resource 18 | $clone = clone $image; 19 | $image->setBackup($clone->getCore(), $backupName); 20 | 21 | return true; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BlurCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->between(0, 100)->value(1); 16 | 17 | return $image->getCore()->blurImage(1 * $amount, 0.5 * $amount); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BrightnessCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->between(-100, 100)->required()->value(); 16 | 17 | return $image->getCore()->modulateImage(100 + $level, 100, 100); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ContrastCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->between(-100, 100)->required()->value(); 16 | 17 | return $image->getCore()->sigmoidalContrastImage($level > 0, $level / 4, 0); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/DestroyCommand.php: -------------------------------------------------------------------------------- 1 | getCore()->clear(); 17 | 18 | // destroy backups 19 | foreach ($image->getBackups() as $backup) { 20 | $backup->clear(); 21 | } 22 | 23 | return true; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FlipCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->value('h'); 16 | 17 | if (in_array(strtolower($mode), [2, 'v', 'vert', 'vertical'])) { 18 | // flip vertical 19 | return $image->getCore()->flipImage(); 20 | } else { 21 | // flip horizontal 22 | return $image->getCore()->flopImage(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GammaCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->type('numeric')->required()->value(); 16 | 17 | return $image->getCore()->gammaImage($gamma); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GetSizeCommand.php: -------------------------------------------------------------------------------- 1 | getCore(); 19 | 20 | $this->setOutput(new Size( 21 | $core->getImageWidth(), 22 | $core->getImageHeight() 23 | )); 24 | 25 | return true; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GreyscaleCommand.php: -------------------------------------------------------------------------------- 1 | getCore()->modulateImage(100, 0, 100); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/HeightenCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->type('digit')->required()->value(); 16 | $additionalConstraints = $this->argument(1)->type('closure')->value(); 17 | 18 | $this->arguments[0] = null; 19 | $this->arguments[1] = $height; 20 | $this->arguments[2] = function ($constraint) use ($additionalConstraints) { 21 | $constraint->aspectRatio(); 22 | if(is_callable($additionalConstraints)) 23 | $additionalConstraints($constraint); 24 | }; 25 | 26 | return parent::execute($image); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InsertCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->required()->value(); 16 | $position = $this->argument(1)->type('string')->value(); 17 | $x = $this->argument(2)->type('digit')->value(0); 18 | $y = $this->argument(3)->type('digit')->value(0); 19 | 20 | // build watermark 21 | $watermark = $image->getDriver()->init($source); 22 | 23 | // define insertion point 24 | $image_size = $image->getSize()->align($position, $x, $y); 25 | $watermark_size = $watermark->getSize()->align($position); 26 | $target = $image_size->relativePosition($watermark_size); 27 | 28 | // insert image at position 29 | return $image->getCore()->compositeImage($watermark->getCore(), \Imagick::COMPOSITE_DEFAULT, $target->x, $target->y); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InterlaceCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->type('bool')->value(true); 16 | 17 | if ($mode) { 18 | $mode = \Imagick::INTERLACE_LINE; 19 | } else { 20 | $mode = \Imagick::INTERLACE_NO; 21 | } 22 | 23 | $image->getCore()->setInterlaceScheme($mode); 24 | 25 | return true; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InvertCommand.php: -------------------------------------------------------------------------------- 1 | getCore()->negateImage(false); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/OpacityCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->between(0, 100)->required()->value(); 16 | 17 | $transparency = $transparency > 0 ? (100 / $transparency) : 1000; 18 | 19 | return $image->getCore()->evaluateImage(\Imagick::EVALUATE_DIVIDE, $transparency, \Imagick::CHANNEL_ALPHA); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PickColorCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->type('digit')->required()->value(); 18 | $y = $this->argument(1)->type('digit')->required()->value(); 19 | $format = $this->argument(2)->type('string')->value('array'); 20 | 21 | // pick color 22 | $color = new Color($image->getCore()->getImagePixelColor($x, $y)); 23 | 24 | // format to output 25 | $this->setOutput($color->format($format)); 26 | 27 | return true; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PixelCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->required()->value(); 18 | $color = new Color($color); 19 | $x = $this->argument(1)->type('digit')->required()->value(); 20 | $y = $this->argument(2)->type('digit')->required()->value(); 21 | 22 | // prepare pixel 23 | $draw = new \ImagickDraw; 24 | $draw->setFillColor($color->getPixel()); 25 | $draw->point($x, $y); 26 | 27 | // apply pixel 28 | return $image->getCore()->drawImage($draw); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PixelateCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->type('digit')->value(10); 16 | 17 | $width = $image->getWidth(); 18 | $height = $image->getHeight(); 19 | 20 | $image->getCore()->scaleImage(max(1, ($width / $size)), max(1, ($height / $size))); 21 | $image->getCore()->scaleImage($width, $height); 22 | 23 | return true; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResetCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->value(); 16 | 17 | $backup = $image->getBackup($backupName); 18 | 19 | if ($backup instanceof \Imagick) { 20 | 21 | // destroy current core 22 | $image->getCore()->clear(); 23 | 24 | // clone backup 25 | $backup = clone $backup; 26 | 27 | // reset to new resource 28 | $image->setCore($backup); 29 | 30 | return true; 31 | } 32 | 33 | throw new \Intervention\Image\Exception\RuntimeException( 34 | "Backup not available. Call backup({$backupName}) before reset()." 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResizeCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->value(); 16 | $height = $this->argument(1)->value(); 17 | $constraints = $this->argument(2)->type('closure')->value(); 18 | 19 | // resize box 20 | $resized = $image->getSize()->resize($width, $height, $constraints); 21 | 22 | // modify image 23 | $image->getCore()->scaleImage($resized->getWidth(), $resized->getHeight()); 24 | 25 | return true; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/RotateCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->type('numeric')->required()->value(); 18 | $color = $this->argument(1)->value(); 19 | $color = new Color($color); 20 | 21 | // restrict rotations beyond 360 degrees, since the end result is the same 22 | $angle %= 360; 23 | 24 | // rotate image 25 | $image->getCore()->rotateImage($color->getPixel(), ($angle * -1)); 26 | 27 | return true; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/SharpenCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->between(0, 100)->value(10); 16 | 17 | return $image->getCore()->unsharpMaskImage(1, 1, $amount / 6.25, 0); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/WidenCommand.php: -------------------------------------------------------------------------------- 1 | argument(0)->type('digit')->required()->value(); 16 | $additionalConstraints = $this->argument(1)->type('closure')->value(); 17 | 18 | $this->arguments[0] = $width; 19 | $this->arguments[1] = null; 20 | $this->arguments[2] = function ($constraint) use ($additionalConstraints) { 21 | $constraint->aspectRatio(); 22 | if(is_callable($additionalConstraints)) 23 | $additionalConstraints($constraint); 24 | }; 25 | 26 | return parent::execute($image); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/CircleShape.php: -------------------------------------------------------------------------------- 1 | width = is_numeric($diameter) ? intval($diameter) : $this->diameter; 24 | $this->height = is_numeric($diameter) ? intval($diameter) : $this->diameter; 25 | $this->diameter = is_numeric($diameter) ? intval($diameter) : $this->diameter; 26 | } 27 | 28 | /** 29 | * Draw current circle on given image 30 | * 31 | * @param Image $image 32 | * @param int $x 33 | * @param int $y 34 | * @return boolean 35 | */ 36 | public function applyToImage(Image $image, $x = 0, $y = 0) 37 | { 38 | return parent::applyToImage($image, $x, $y); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/Intervention/Image/Point.php: -------------------------------------------------------------------------------- 1 | x = is_numeric($x) ? intval($x) : 0; 30 | $this->y = is_numeric($y) ? intval($y) : 0; 31 | } 32 | 33 | /** 34 | * Sets X coordinate 35 | * 36 | * @param int $x 37 | */ 38 | public function setX($x) 39 | { 40 | $this->x = intval($x); 41 | } 42 | 43 | /** 44 | * Sets Y coordinate 45 | * 46 | * @param int $y 47 | */ 48 | public function setY($y) 49 | { 50 | $this->y = intval($y); 51 | } 52 | 53 | /** 54 | * Sets both X and Y coordinate 55 | * 56 | * @param int $x 57 | * @param int $y 58 | */ 59 | public function setPosition($x, $y) 60 | { 61 | $this->setX($x); 62 | $this->setY($y); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/intervention/image/src/config/config.php: -------------------------------------------------------------------------------- 1 | 'gd' 19 | 20 | ]; 21 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | vendor 3 | docs/_site -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/.scrutinizer.yml: -------------------------------------------------------------------------------- 1 | filter: 2 | paths: [src/*] 3 | excluded_paths: [tests/*] 4 | checks: 5 | php: 6 | code_rating: true 7 | remove_extra_empty_lines: true 8 | remove_php_closing_tag: true 9 | remove_trailing_whitespace: true 10 | fix_use_statements: 11 | remove_unused: true 12 | preserve_multiple: false 13 | preserve_blanklines: true 14 | order_alphabetically: true 15 | fix_php_opening_tag: true 16 | fix_linefeed: true 17 | fix_line_ending: true 18 | fix_identation_4spaces: true 19 | fix_doc_comments: true 20 | tools: 21 | external_code_coverage: 22 | timeout: 600 23 | runs: 3 24 | php_code_coverage: false 25 | php_code_sniffer: 26 | config: 27 | standard: PSR2 28 | filter: 29 | paths: ['src'] 30 | php_loc: 31 | enabled: true 32 | excluded_dirs: [vendor, test] 33 | php_cpd: 34 | enabled: true 35 | excluded_dirs: [vendor, test] -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | sudo: false 4 | 5 | env: 6 | - COMPOSER_OPTS="" 7 | - COMPOSER_OPTS="--prefer-lowest" 8 | 9 | php: 10 | - 5.4 11 | - 5.5 12 | - 5.6 13 | - 7.0 14 | - 7.1 15 | - 7.2 16 | 17 | cache: 18 | directories: 19 | - $HOME/.composer/cache 20 | 21 | before_install: 22 | - travis_retry composer self-update 23 | 24 | install: 25 | - travis_retry composer update --no-interaction --prefer-source 26 | 27 | script: 28 | - phpunit --coverage-text --coverage-clover=coverage.clover 29 | 30 | after_script: 31 | - wget https://scrutinizer-ci.com/ocular.phar 32 | - php ocular.phar code-coverage:upload --format=php-clover coverage.clover 33 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to Glide can be found on [GitHub](https://github.com/thephpleague/glide/releases). 4 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Contributions are **welcome** and will be fully **credited**. 4 | 5 | We accept contributions via Pull Requests on [Github](https://github.com/thephpleague/glide). 6 | 7 | ## Pull Requests 8 | 9 | - **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer). 10 | - **Add tests!** - Your patch won't be accepted if it doesn't have tests. 11 | - **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. 12 | - **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option. 13 | - **Create feature branches** - Don't ask us to pull from your master branch. 14 | - **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. 15 | - **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting. 16 | 17 | ## Running Tests 18 | 19 | ``` bash 20 | $ phpunit 21 | ``` 22 | 23 | **Happy coding**! -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Jonathan Reinink 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "league/glide", 3 | "description": "Wonderfully easy on-demand image manipulation library with an HTTP based API.", 4 | "keywords": [ 5 | "league", 6 | "image", 7 | "processing", 8 | "manipulation", 9 | "editing", 10 | "gd", 11 | "imagemagick", 12 | "imagick" 13 | ], 14 | "homepage": "http://glide.thephpleague.com", 15 | "license": "MIT", 16 | "authors" : [ 17 | { 18 | "name": "Jonathan Reinink", 19 | "email": "jonathan@reinink.ca", 20 | "homepage": "http://reinink.ca" 21 | } 22 | ], 23 | "require": { 24 | "intervention/image": "^2.1", 25 | "league/flysystem": "^1.0", 26 | "php": "^5.4 | ^7.0", 27 | "psr/http-message": "^1.0" 28 | }, 29 | "require-dev": { 30 | "mockery/mockery": "~0.9", 31 | "phpunit/php-token-stream": "^1.4", 32 | "phpunit/phpunit": "~4.4" 33 | }, 34 | "autoload": { 35 | "psr-4": { 36 | "League\\Glide\\": "src/" 37 | } 38 | }, 39 | "extra": { 40 | "branch-alias": { 41 | "dev-master": "1.1-dev" 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/0.3/_data/project.yml: -------------------------------------------------------------------------------- 1 | title: TEST -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/0.3/api/effects.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Effects 4 | --- 5 | 6 | # Effects 7 | 8 | ## Blur `blur` 9 | 10 | Adds a blur effect to the image. Use values between `0` and `100`. 11 | 12 | ~~~ html 13 | Performance intensive on larger amounts of blur with GD driver. Use with care. 19 | 20 | ## Pixelate `pixel` 21 | 22 | Applies a pixelation effect to the image. Use values between `0` and `1000`. 23 | 24 | ~~~ html 25 |
36 | ~~~ 37 | 38 | [](https://glide.herokuapp.com/0.3/kayaks.jpg?w=500&filt=sepia) -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/0.3/api/output.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Output 4 | --- 5 | 6 | # Output 7 | 8 | ## Quality `q` 9 | 10 | Defines the quality of the image. Use values between `0` and `100`. Defaults to `90`. Only relevant if the format is set to `jpg`. 11 | 12 | ~~~ html 13 |
25 | ~~~ 26 | 27 | [](https://glide.herokuapp.com/0.3/kayaks.jpg?w=500&fm=gif) -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/0.3/changelog.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Changelog 4 | --- 5 | 6 | # Changelog 7 | 8 | All notable changes to Glide will be documented in this file. 9 | 10 | {% for release in site.github.releases %} 11 | ## [{{ release.name }}]({{ release.html_url }}) - {{ release.published_at | date: "%Y-%m-%d" }} 12 | {{ release.body | markdownify }} 13 | {% endfor %} -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/0.3/config/base-url.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Base URL 4 | --- 5 | 6 | # Base URL 7 | 8 | It's common to route all images under the path `/img/`. However, since Glide maps image request paths directly to the image source paths, you would have to have an `/img/` folder in your source location as well. For example: 9 | 10 | ~~~ js 11 | 'http://example.com/img/kayaks.jpg' => '/path/to/source/img/kayaks.jpg' 12 | 'http://example.com/img/users/jonathan.jpg' => '/path/to/source/img/users/jonathan.jpg' 13 | ~~~ 14 | 15 | Since this isn't ideal, Glide allows you to define a `base_url` which is omitted from the source path. 16 | 17 | ## Set the base URL 18 | 19 | ~~~ php 20 | '/img/', 25 | ]); 26 | 27 | // Set using setter method 28 | $server->setBaseUrl('/img/'); 29 | ~~~ 30 | 31 | With the base URL configured, the new image source paths will no longer include `/img/`. 32 | 33 | ~~~ js 34 | 'http://example.com/img/kayaks.jpg' => '/path/to/source/kayaks.jpg' 35 | 'http://example.com/img/users/jonathan.jpg' => '/path/to/source/users/jonathan.jpg' 36 | ~~~ -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/0.3/config/image-driver.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Image driver 4 | --- 5 | 6 | # Image driver 7 | 8 | By default Glide uses the [GD](http://php.net/manual/en/book.image.php) library. However you can also use Glide with [ImageMagick](http://www.imagemagick.org/) if the [Imagick](http://php.net/manual/en/book.imagick.php) PHP extension is installed. 9 | 10 | ~~~ php 11 | 'imagick', 15 | ]); 16 | ~~~ -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/0.3/config/max-image-size.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Max image size 4 | --- 5 | 6 | # Max image size 7 | 8 | In addition to [securing images](/config/secure-images/) with a signing key, you can also limit how large images can be generated. The following setting will set the maximum allowed total image size, in pixels. 9 | 10 | ~~~ php 11 | 2000*2000, 15 | ]); 16 | ~~~ 17 | 18 | Notice that Glide doesn't actually restrict the width or height, but rather the total image size. In the above example it would be `4000000px`. This accomplishes the exact same thing, while offering more flexibility with your image sizes. -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/0.3/installation.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Installation 4 | --- 5 | 6 | # Installation 7 | 8 | ## Using Composer 9 | 10 | Glide is available on [Packagist](https://packagist.org/packages/league/glide) and can be installed using [Composer](https://getcomposer.org/). This can be done by running the following command: 11 | 12 | ~~~ bash 13 | composer require league/glide 14 | ~~~ 15 | 16 | Be sure to also include the Composer autoload file in your project: 17 | 18 | ~~~ php 19 | 14 | ~~~ 15 | 16 | [](https://glide.herokuapp.com/1.0/logo.png?w=500&bg=black) -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/1.0/api/border.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Border 4 | --- 5 | 6 | # Border 7 | 8 | ## Border `border` 9 | 10 | Add a border to the image. Required format: `width,color,method`. 11 | 12 | ~~~ html 13 |
14 | ~~~ 15 | 16 | [](https://glide.herokuapp.com/1.0/kayaks.jpg?w=500&border=10,5000,overlay) 17 | 18 | ### Width 19 | 20 | Sets the border width in pixels, or using [relative dimensions](api/relative-dimensions/). 21 | 22 | ### Color 23 | 24 | Sets the border color. See [colors](api/colors/) for more information on the available color formats. 25 | 26 | ### Method 27 | 28 | Sets how the border will be displayed. Available options: 29 | 30 | - `overlay`: Place border on top of image (default). 31 | - `shrink`: Shrink image within border (canvas does not change). 32 | - `expand`: Expands canvas to accommodate border. 33 | 34 | ~~~ html 35 |
36 | ~~~ 37 | 38 | [](https://glide.herokuapp.com/1.0/kayaks.jpg?w=500&border=10,FFCC33,expand) -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/1.0/api/effects.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Effects 4 | --- 5 | 6 | # Effects 7 | 8 | ## Blur `blur` 9 | 10 | Adds a blur effect to the image. Use values between `0` and `100`. 11 | 12 | ~~~ html 13 |
Performance intensive on larger amounts of blur with GD driver. Use with care. 19 | 20 | ## Pixelate `pixel` 21 | 22 | Applies a pixelation effect to the image. Use values between `0` and `1000`. 23 | 24 | ~~~ html 25 |
36 | ~~~ 37 | 38 | [](https://glide.herokuapp.com/1.0/kayaks.jpg?w=500&filt=sepia) -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/1.0/api/encode.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Encode 4 | --- 5 | 6 | # Encode 7 | 8 | ## Quality `q` 9 | 10 | Defines the quality of the image. Use values between `0` and `100`. Defaults to `90`. Only relevant if the format is set to `jpg`. 11 | 12 | ~~~ html 13 |
14 | ~~~ 15 | 16 | [](https://glide.herokuapp.com/1.0/kayaks.jpg?w=500&q=25) 17 | 18 | 19 | ## Format `fm` 20 | 21 | Encodes the image to a specific format. Accepts `jpg`, `pjpg` (progressive jpeg), `png` or `gif`. Defaults to `jpg`. 22 | 23 | ~~~ html 24 |
25 | ~~~ 26 | 27 | [](https://glide.herokuapp.com/1.0/kayaks.jpg?w=500&fm=gif) -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/1.0/api/flip.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Flip 4 | --- 5 | 6 | # Flip 7 | 8 | ## Flip `flip` 9 | 10 | Flips the image. Accepts `v`, `h` and `both`. 11 | 12 | ~~~ html 13 |
14 | ~~~ 15 | 16 | [](https://glide.herokuapp.com/1.0/kayaks.jpg?h=500&flip=v) 17 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/1.0/api/orientation.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Orientation 4 | --- 5 | 6 | # Orientation 7 | 8 | ## Orientation `or` 9 | 10 | Rotates the image. Accepts `auto`, `0`, `90`, `180` or `270`. Default is `auto`. The `auto` option uses Exif data to automatically orient images correctly. 11 | 12 | ~~~ html 13 |
14 | ~~~ 15 | 16 | [](https://glide.herokuapp.com/1.0/kayaks.jpg?h=500&or=90) -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/1.0/api/pixel-density.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Pixel Density 4 | --- 5 | 6 | # Pixel Density 7 | 8 | ## Device pixel ratio `dpr` 9 | 10 | The device pixel ratio is used to easily convert between CSS pixels and device pixels. This makes it possible to display images at the correct pixel density on a variety of devices such as Apple devices with Retina Displays and Android devices. You must specify either a width, a height, or both for this parameter to work. The default is 1. The maximum value that can be set for dpr is 8. 11 | 12 | ~~~ html 13 |
14 | ~~~ 15 | 16 | [](https://glide.herokuapp.com/1.0/kayaks.jpg?w=250&dpr=2) -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/1.0/api/relative-dimensions.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Relative dimensions 4 | --- 5 | 6 | # Relative dimensions 7 | 8 | Relative dimensions allow you to specify a width or height value as a percentage of the main image. This is helpful for features like watermarks and borders. 9 | 10 | To use a relative dimension, simply provide a percentage as a number (between `0` and `100`), followed by a `w` (width) or `h` (height). For example, `5w` represents 5% of the width of the main image. 11 | 12 | ~~~ html 13 |
14 | ~~~ -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/1.0/changelog.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Changelog 4 | --- 5 | 6 | # Changelog 7 | 8 | All notable changes to Glide will be documented in this file. 9 | 10 | {% for release in site.github.releases %} 11 | ## [{{ release.name }}]({{ release.html_url }}) - {{ release.published_at | date: "%Y-%m-%d" }} 12 | {{ release.body | markdownify }} 13 | {% endfor %} 14 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/1.0/config/image-driver.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Image driver 4 | --- 5 | 6 | # Image driver 7 | 8 | By default Glide uses the [GD](http://php.net/manual/en/book.image.php) library. However you can also use Glide with [ImageMagick](http://www.imagemagick.org/) if the [Imagick](http://php.net/manual/en/book.imagick.php) PHP extension is installed. 9 | 10 | ~~~ php 11 | 'gd', 17 | 18 | // Use ImageMagick 19 | 'driver' => 'imagick', 20 | ]); 21 | ~~~ -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/1.0/config/integrations/cakephp.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: CakePHP integration 4 | --- 5 | 6 | # CakePHP integration 7 | 8 | If your application uses the [CakePHP](http://cakephp.org/) framework, you can use the `CakeResponseFactory`. 9 | 10 | 11 | 12 | ## Installation 13 | 14 | ~~~ bash 15 | composer require league/glide-cake 16 | ~~~ 17 | 18 | ## Configuration 19 | 20 | ~~~ php 21 | new CakeResponseFactory() 28 | ]); 29 | ~~~ -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/1.0/config/integrations/psr-7.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: PSR-7 integration 4 | --- 5 | 6 | # PSR-7 integration 7 | 8 | Glide ships with the `PsrResponseFactory` class, allowing you to use any [PSR-7](http://www.php-fig.org/psr/psr-7/) compliant library. However, since Glide only depends on the PSR-7 interfaces, it cannot actually create the `Response` or `Stream` objects. Instead, you must provide them. 9 | 10 | ## Configuration 11 | 12 | The following example uses the [Zend Diactoros](https://github.com/zendframework/zend-diactoros) library, but any PSR-7 compatible package will work. 13 | 14 | ~~~ php 15 | new PsrResponseFactory(new Response(), function ($stream) { 24 | return new Stream($stream); 25 | }), 26 | ]); 27 | ~~~ 28 | 29 | ## Vendor specific adapters 30 | 31 | However, for simplicity, Glide provides a vendor specific PSR-7 adapters to make this easier: 32 | 33 | - [Slim](/1.0/config/integrations/slim/) 34 | - [Zend](/1.0/config/integrations/zend/) -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/1.0/config/integrations/slim.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Slim integration 4 | --- 5 | 6 | # Slim integration 7 | 8 | If your application uses [Slim](http://www.slimframework.com/) framework, you can use the `SlimResponseFactory`. 9 | 10 | 11 | 12 | ## Installation 13 | 14 | ~~~ bash 15 | composer require league/slim 16 | ~~~ 17 | 18 | ## Configuration 19 | 20 | ~~~ php 21 | new SlimResponseFactory(), 28 | ]); 29 | ~~~ -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/1.0/config/integrations/symfony.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Symfony (HttpFoundation) integration 4 | --- 5 | 6 | # Symfony integration 7 | 8 | If your application uses the [Symfony](https://symfony.com/) framework or anything that uses the `HttpFoundation` library, you can use the `SymfonyResponseFactory`. 9 | 10 | ## Installation 11 | 12 | ~~~ bash 13 | composer require league/glide-symfony 14 | ~~~ 15 | 16 | ## Configuration 17 | 18 | ~~~ php 19 | new SymfonyResponseFactory() 26 | ]); 27 | ~~~ -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/1.0/config/integrations/zend.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Zend integration 4 | --- 5 | 6 | # Zend integration 7 | 8 | If your application uses the [Zend Diactoros](https://github.com/zendframework/zend-diactoros) package, for example within the [Zend Expressive](http://framework.zend.com/expressive), you can use the `ZendResponseFactory`. 9 | 10 | ## Installation 11 | 12 | ~~~ bash 13 | composer require league/glide-zend 14 | ~~~ 15 | 16 | ## Configuration 17 | 18 | ~~~ php 19 | new ZendResponseFactory(), 26 | ]); 27 | ~~~ 28 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/1.0/installation.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Installation 4 | --- 5 | 6 | # Installation 7 | 8 | ## Using Composer 9 | 10 | Glide is available on [Packagist](https://packagist.org/packages/league/glide) and can be installed using [Composer](https://getcomposer.org/). This can be done by running the following command: 11 | 12 | ~~~ bash 13 | composer require league/glide 14 | ~~~ 15 | 16 | Be sure to also include the Composer autoload file in your project: 17 | 18 | ~~~ php 19 | See responses for more information about integrating with a specific framework. 37 | 38 | ## Downloading .zip file 39 | 40 | This project is also available for download as a `.zip` file on GitHub. Visit the [releases page](https://github.com/thephpleague/glide/releases), select the version you want, and click the "Source code (zip)" download button. -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/1.0/screencasts.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Screencasts 4 | --- 5 | 6 | # Screencasts 7 | 8 | - Using queues to eager generate images 9 | - Installing Glide on Laravel 5.1 10 | - Installing Glide on Slim 3.0 11 | - Setting up Glide on standalone Heroku server -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/CNAME: -------------------------------------------------------------------------------- 1 | glide.thephpleague.com -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/_config.yml: -------------------------------------------------------------------------------- 1 | permalink: pretty -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/_data/images.yml: -------------------------------------------------------------------------------- 1 | # Path to project specific favicon.ico, leave blank to use default 2 | favicon: /favicon.ico 3 | 4 | # Path to project specific apple-touch-icon-precomposed.png, leave blank to use default 5 | apple_touch: /apple-touch-icon-precomposed.png 6 | 7 | # Path to project logo 8 | logo: /logo.png -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/_data/project.yml: -------------------------------------------------------------------------------- 1 | title: Glide 2 | tagline: HTTP based image manipulations 3 | description: Wonderfully easy on-demand image manipulation library with an HTTP based API. 4 | google_analytics_tracking_id: UA-46050814-13 5 | default_version: "1.0" -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmlic/PHP-ML-study/700b10a92e3d45cb794458db6547e73ac9082e2a/practice/pic_classify/vendor/league/glide/docs/apple-touch-icon-precomposed.png -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/custom.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | $('.versions').change(function (e) { 3 | location.href = $(this).find('option:selected').data('url'); 4 | }); 5 | }); -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmlic/PHP-ML-study/700b10a92e3d45cb794458db6547e73ac9082e2a/practice/pic_classify/vendor/league/glide/docs/favicon.ico -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/docs/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmlic/PHP-ML-study/700b10a92e3d45cb794458db6547e73ac9082e2a/practice/pic_classify/vendor/league/glide/docs/logo.png -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 |
3 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/src/Api/ApiInterface.php: -------------------------------------------------------------------------------- 1 | bg)) { 21 | return $image; 22 | } 23 | 24 | $color = (new Color($this->bg))->formatted(); 25 | 26 | if ($color) { 27 | $new = $image->getDriver()->newImage($image->width(), $image->height(), $color); 28 | $new->mime = $image->mime; 29 | $image = $new->insert($image, 'top-left', 0, 0); 30 | } 31 | 32 | return $image; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/src/Manipulators/BaseManipulator.php: -------------------------------------------------------------------------------- 1 | params = $params; 22 | 23 | return $this; 24 | } 25 | 26 | /** 27 | * Get a specific manipulation param. 28 | * @param string $name The manipulation name. 29 | * @return string The manipulation value. 30 | */ 31 | public function __get($name) 32 | { 33 | if (array_key_exists($name, $this->params)) { 34 | return $this->params[$name]; 35 | } 36 | } 37 | 38 | /** 39 | * Perform the image manipulation. 40 | * @return Image The manipulated image. 41 | */ 42 | abstract public function run(Image $image); 43 | } 44 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/src/Manipulators/Blur.php: -------------------------------------------------------------------------------- 1 | getBlur(); 20 | 21 | if ($blur !== null) { 22 | $image->blur($blur); 23 | } 24 | 25 | return $image; 26 | } 27 | 28 | /** 29 | * Resolve blur amount. 30 | * @return string The resolved blur amount. 31 | */ 32 | public function getBlur() 33 | { 34 | if (!is_numeric($this->blur)) { 35 | return; 36 | } 37 | 38 | if ($this->blur < 0 or $this->blur > 100) { 39 | return; 40 | } 41 | 42 | return (int) $this->blur; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/src/Manipulators/Brightness.php: -------------------------------------------------------------------------------- 1 | getBrightness(); 20 | 21 | if ($brightness !== null) { 22 | $image->brightness($brightness); 23 | } 24 | 25 | return $image; 26 | } 27 | 28 | /** 29 | * Resolve brightness amount. 30 | * @return string The resolved brightness amount. 31 | */ 32 | public function getBrightness() 33 | { 34 | if (!preg_match('/^-*[0-9]+$/', $this->bri)) { 35 | return; 36 | } 37 | 38 | if ($this->bri < -100 or $this->bri > 100) { 39 | return; 40 | } 41 | 42 | return (int) $this->bri; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/src/Manipulators/Contrast.php: -------------------------------------------------------------------------------- 1 | getContrast(); 20 | 21 | if ($contrast !== null) { 22 | $image->contrast($contrast); 23 | } 24 | 25 | return $image; 26 | } 27 | 28 | /** 29 | * Resolve contrast amount. 30 | * @return string The resolved contrast amount. 31 | */ 32 | public function getContrast() 33 | { 34 | if (!preg_match('/^-*[0-9]+$/', $this->con)) { 35 | return; 36 | } 37 | 38 | if ($this->con < -100 or $this->con > 100) { 39 | return; 40 | } 41 | 42 | return (int) $this->con; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/src/Manipulators/Flip.php: -------------------------------------------------------------------------------- 1 | getFlip()) { 20 | if ($flip === 'both') { 21 | return $image->flip('h')->flip('v'); 22 | } 23 | 24 | return $image->flip($flip); 25 | } 26 | 27 | return $image; 28 | } 29 | 30 | /** 31 | * Resolve flip. 32 | * @return string The resolved flip. 33 | */ 34 | public function getFlip() 35 | { 36 | if (in_array($this->flip, ['h', 'v', 'both'], true)) { 37 | return $this->flip; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/src/Manipulators/Gamma.php: -------------------------------------------------------------------------------- 1 | getGamma(); 20 | 21 | if ($gamma) { 22 | $image->gamma($gamma); 23 | } 24 | 25 | return $image; 26 | } 27 | 28 | /** 29 | * Resolve gamma amount. 30 | * @return string The resolved gamma amount. 31 | */ 32 | public function getGamma() 33 | { 34 | if (!preg_match('/^[0-9]\.*[0-9]*$/', $this->gam)) { 35 | return; 36 | } 37 | 38 | if ($this->gam < 0.1 or $this->gam > 9.99) { 39 | return; 40 | } 41 | 42 | return (double) $this->gam; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/src/Manipulators/Helpers/Dimension.php: -------------------------------------------------------------------------------- 1 | image = $image; 29 | $this->dpr = $dpr; 30 | } 31 | 32 | /** 33 | * Resolve the dimension. 34 | * @param string $value The dimension value. 35 | * @return double The resolved dimension. 36 | */ 37 | public function get($value) 38 | { 39 | if (is_numeric($value) and $value > 0) { 40 | return (double) $value * $this->dpr; 41 | } 42 | 43 | if (preg_match('/^(\d{1,2}(?!\d)|100)(w|h)$/', $value, $matches)) { 44 | if ($matches[2] === 'h') { 45 | return (double) $this->image->height() * ($matches[1] / 100); 46 | } 47 | 48 | return (double) $this->image->width() * ($matches[1] / 100); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/src/Manipulators/ManipulatorInterface.php: -------------------------------------------------------------------------------- 1 | getOrientation(); 20 | 21 | if ($orientation === 'auto') { 22 | return $image->orientate(); 23 | } 24 | 25 | return $image->rotate($orientation); 26 | } 27 | 28 | /** 29 | * Resolve orientation. 30 | * @return string The resolved orientation. 31 | */ 32 | public function getOrientation() 33 | { 34 | if (in_array($this->or, ['auto', '0', '90', '180', '270'], true)) { 35 | return $this->or; 36 | } 37 | 38 | return 'auto'; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/src/Manipulators/Pixelate.php: -------------------------------------------------------------------------------- 1 | getPixelate(); 20 | 21 | if ($pixelate !== null) { 22 | $image->pixelate($pixelate); 23 | } 24 | 25 | return $image; 26 | } 27 | 28 | /** 29 | * Resolve pixelate amount. 30 | * @return string The resolved pixelate amount. 31 | */ 32 | public function getPixelate() 33 | { 34 | if (!is_numeric($this->pixel)) { 35 | return; 36 | } 37 | 38 | if ($this->pixel < 0 or $this->pixel > 1000) { 39 | return; 40 | } 41 | 42 | return (int) $this->pixel; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/src/Manipulators/Sharpen.php: -------------------------------------------------------------------------------- 1 | getSharpen(); 20 | 21 | if ($sharpen !== null) { 22 | $image->sharpen($sharpen); 23 | } 24 | 25 | return $image; 26 | } 27 | 28 | /** 29 | * Resolve sharpen amount. 30 | * @return string The resolved sharpen amount. 31 | */ 32 | public function getSharpen() 33 | { 34 | if (!is_numeric($this->sharp)) { 35 | return; 36 | } 37 | 38 | if ($this->sharp < 0 or $this->sharp > 100) { 39 | return; 40 | } 41 | 42 | return (int) $this->sharp; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/src/Responses/ResponseFactoryInterface.php: -------------------------------------------------------------------------------- 1 | assertSame('rgba(0, 0, 0, 1)', $color->formatted()); 12 | } 13 | 14 | public function testFourDigitColorCode() 15 | { 16 | $color = new Color('5000'); 17 | 18 | $this->assertSame('rgba(0, 0, 0, 0.5)', $color->formatted()); 19 | } 20 | 21 | public function testSixDigitColorCode() 22 | { 23 | $color = new Color('000000'); 24 | 25 | $this->assertSame('rgba(0, 0, 0, 1)', $color->formatted()); 26 | } 27 | 28 | public function testEightDigitColorCode() 29 | { 30 | $color = new Color('50000000'); 31 | 32 | $this->assertSame('rgba(0, 0, 0, 0.5)', $color->formatted()); 33 | } 34 | 35 | public function testNamedColorCode() 36 | { 37 | $color = new Color('black'); 38 | 39 | $this->assertSame('rgba(0, 0, 0, 1)', $color->formatted()); 40 | } 41 | 42 | public function testUnknownColor() 43 | { 44 | $color = new Color('unknown'); 45 | 46 | $this->assertSame('rgba(255, 255, 255, 0)', $color->formatted()); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/tests/Signatures/SignatureFactoryTest.php: -------------------------------------------------------------------------------- 1 | assertInstanceOf('League\Glide\Signatures\Signature', SignatureFactory::create('example')); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/league/glide/tests/Urls/UrlBuilderFactoryTest.php: -------------------------------------------------------------------------------- 1 | assertInstanceOf('League\Glide\Urls\UrlBuilder', $urlBuilder); 12 | $this->assertEquals('/img/image.jpg', $urlBuilder->getUrl('image.jpg')); 13 | } 14 | 15 | public function testCreateWithSignKey() 16 | { 17 | $urlBuilder = UrlBuilderFactory::create('img', 'example-sign-key'); 18 | 19 | $this->assertEquals( 20 | '/img/image.jpg?s=56020c3dc5f68487c14510343c3e2c43', 21 | $urlBuilder->getUrl('image.jpg') 22 | ); 23 | } 24 | 25 | public function testCreateWithSignKeyWithLeadingSlash() 26 | { 27 | $urlBuilder = UrlBuilderFactory::create('/img', 'example-sign-key'); 28 | 29 | $this->assertEquals( 30 | '/img/image.jpg?s=56020c3dc5f68487c14510343c3e2c43', 31 | $urlBuilder->getUrl('image.jpg') 32 | ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/nancheng/pfinal-array/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 |4 | 8 |5 | 7 |tests/ 6 |9 | 13 |10 | 12 |src/ 11 |14 | 20 |15 | 16 | 17 | 18 | 19 | 2 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/nancheng/pfinal-array/.idea/dictionaries/qiuzi.xml: -------------------------------------------------------------------------------- 1 |3 | 2 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/nancheng/pfinal-array/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 |3 | 3 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/nancheng/pfinal-array/.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 |4 | 6 |5 | 2 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/nancheng/pfinal-array/.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 |3 | 4 | 13 |5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |2 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/nancheng/pfinal-array/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 |3 | 4 | 5 | 7 |6 | 3 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/nancheng/pfinal-array/.idea/pfinal-array.iml: -------------------------------------------------------------------------------- 1 | 2 |4 | 8 |5 | 7 |6 | 3 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/nancheng/pfinal-array/.idea/php.xml: -------------------------------------------------------------------------------- 1 | 2 |4 | 8 |5 | 6 | 7 | 3 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/nancheng/pfinal-array/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 |4 | 8 |5 | 7 |6 | 3 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/nancheng/pfinal-array/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nancheng/pfinal-array", 3 | "description": "This is a PHP array manipulation middleware", 4 | "authors": [ 5 | { 6 | "name": "小九", 7 | "email": "Lampxiezi@163.com", 8 | "homepage": "http://friday-go.cc/" 9 | } 10 | ], 11 | "homepage":"https://github.com/Neroxiezi/pfinal-array", 12 | "license": "MIT", 13 | "keywords": [ 14 | "pfinal", 15 | "南丞", 16 | "Q哥", 17 | "array", 18 | "php-array" 19 | ], 20 | 21 | "require": { 22 | "php": ">=5.4.0" 23 | }, 24 | "autoload": { 25 | "psr-4": { 26 | "pf\\arr\\": "src/" 27 | } 28 | }, 29 | "autoload-dev": { 30 | "psr-4": { 31 | "example\\": "example" 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/nancheng/pfinal-array/example/arrayTest.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmlic/PHP-ML-study/700b10a92e3d45cb794458db6547e73ac9082e2a/practice/pic_classify/vendor/nancheng/pfinal-array/example/arrayTest.php -------------------------------------------------------------------------------- /practice/pic_classify/vendor/nancheng/pfinal-array/src/PFarr.php: -------------------------------------------------------------------------------- 1 | pf_array_link = new Base(); 11 | return $this; 12 | } 13 | 14 | public function __call($method, $params) 15 | { 16 | if (is_null($this->pf_array_link)) { 17 | $this->driver(); 18 | } 19 | if (method_exists($this->pf_array_link, $method)) { 20 | return call_user_func_array([$this->pf_array_link, $method], $params); 21 | } 22 | } 23 | 24 | public static function single() 25 | { 26 | static $pf_array_link; 27 | if (is_null($pf_array_link)) { 28 | $pf_array_link = new static(); 29 | } 30 | return $pf_array_link; 31 | } 32 | 33 | public static function __callStatic($name, $arguments) 34 | { 35 | return call_user_func_array([static::single(), $name], $arguments); 36 | } 37 | } -------------------------------------------------------------------------------- /practice/pic_classify/vendor/nancheng/pfinal-array/src/build/PFArrToCsv.php: -------------------------------------------------------------------------------- 1 | delimiter = $delimiter; 12 | $this->text_separator = $text_separator; 13 | $this->replace_text_separator = $replace_text_separator; 14 | $this->line_delimiter = $line_delimiter; 15 | return $this; 16 | } 17 | public function convert($input) { 18 | $lines = array(); 19 | foreach ($input as $v) { 20 | $lines[] = $this->convertLine($v); 21 | } 22 | return implode($this->line_delimiter, $lines); 23 | } 24 | private function convertLine($line) { 25 | $csv_line = array(); 26 | foreach ($line as $v) { 27 | $csv_line[] = is_array($v) ? 28 | $this->convertLine($v) : 29 | $this->text_separator . str_replace($this->text_separator, $this->replace_text_separator, $v) . $this->text_separator; 30 | } 31 | return implode($this->delimiter, $csv_line); 32 | } 33 | } -------------------------------------------------------------------------------- /practice/pic_classify/vendor/psr/http-message/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file, in reverse chronological order by release. 4 | 5 | ## 1.0.1 - 2016-08-06 6 | 7 | ### Added 8 | 9 | - Nothing. 10 | 11 | ### Deprecated 12 | 13 | - Nothing. 14 | 15 | ### Removed 16 | 17 | - Nothing. 18 | 19 | ### Fixed 20 | 21 | - Updated all `@return self` annotation references in interfaces to use 22 | `@return static`, which more closelly follows the semantics of the 23 | specification. 24 | - Updated the `MessageInterface::getHeaders()` return annotation to use the 25 | value `string[][]`, indicating the format is a nested array of strings. 26 | - Updated the `@link` annotation for `RequestInterface::withRequestTarget()` 27 | to point to the correct section of RFC 7230. 28 | - Updated the `ServerRequestInterface::withUploadedFiles()` parameter annotation 29 | to add the parameter name (`$uploadedFiles`). 30 | - Updated a `@throws` annotation for the `UploadedFileInterface::moveTo()` 31 | method to correctly reference the method parameter (it was referencing an 32 | incorrect parameter name previously). 33 | 34 | ## 1.0.0 - 2016-05-18 35 | 36 | Initial stable release; reflects accepted PSR-7 specification. 37 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/psr/http-message/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 PHP Framework Interoperability Group 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/psr/http-message/README.md: -------------------------------------------------------------------------------- 1 | PSR Http Message 2 | ================ 3 | 4 | This repository holds all interfaces/classes/traits related to 5 | [PSR-7](http://www.php-fig.org/psr/psr-7/). 6 | 7 | Note that this is not a HTTP message implementation of its own. It is merely an 8 | interface that describes a HTTP message. See the specification for more details. 9 | 10 | Usage 11 | ----- 12 | 13 | We'll certainly need some stuff in here. -------------------------------------------------------------------------------- /practice/pic_classify/vendor/psr/http-message/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "psr/http-message", 3 | "description": "Common interface for HTTP messages", 4 | "keywords": ["psr", "psr-7", "http", "http-message", "request", "response"], 5 | "homepage": "https://github.com/php-fig/http-message", 6 | "license": "MIT", 7 | "authors": [ 8 | { 9 | "name": "PHP-FIG", 10 | "homepage": "http://www.php-fig.org/" 11 | } 12 | ], 13 | "require": { 14 | "php": ">=5.3.0" 15 | }, 16 | "autoload": { 17 | "psr-4": { 18 | "Psr\\Http\\Message\\": "src/" 19 | } 20 | }, 21 | "extra": { 22 | "branch-alias": { 23 | "dev-master": "1.0.x-dev" 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/psr/log/.gitignore: -------------------------------------------------------------------------------- 1 | vendor 2 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/psr/log/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 PHP Framework Interoperability Group 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/psr/log/Psr/Log/InvalidArgumentException.php: -------------------------------------------------------------------------------- 1 | logger = $logger; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/psr/log/Psr/Log/NullLogger.php: -------------------------------------------------------------------------------- 1 | logger) { }` 11 | * blocks. 12 | */ 13 | class NullLogger extends AbstractLogger 14 | { 15 | /** 16 | * Logs with an arbitrary level. 17 | * 18 | * @param mixed $level 19 | * @param string $message 20 | * @param array $context 21 | * 22 | * @return void 23 | */ 24 | public function log($level, $message, array $context = array()) 25 | { 26 | // noop 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/psr/log/README.md: -------------------------------------------------------------------------------- 1 | PSR Log 2 | ======= 3 | 4 | This repository holds all interfaces/classes/traits related to 5 | [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md). 6 | 7 | Note that this is not a logger of its own. It is merely an interface that 8 | describes a logger. See the specification for more details. 9 | 10 | Usage 11 | ----- 12 | 13 | If you need a logger, you can use the interface like this: 14 | 15 | ```php 16 | logger = $logger; 27 | } 28 | 29 | public function doSomething() 30 | { 31 | if ($this->logger) { 32 | $this->logger->info('Doing work'); 33 | } 34 | 35 | // do something useful 36 | } 37 | } 38 | ``` 39 | 40 | You can then pick one of the implementations of the interface to get a logger. 41 | 42 | If you want to implement the interface, you can require this package and 43 | implement `Psr\Log\LoggerInterface` in your code. Please read the 44 | [specification text](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) 45 | for details. 46 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/psr/log/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "psr/log", 3 | "description": "Common interface for logging libraries", 4 | "keywords": ["psr", "psr-3", "log"], 5 | "homepage": "https://github.com/php-fig/log", 6 | "license": "MIT", 7 | "authors": [ 8 | { 9 | "name": "PHP-FIG", 10 | "homepage": "http://www.php-fig.org/" 11 | } 12 | ], 13 | "require": { 14 | "php": ">=5.3.0" 15 | }, 16 | "autoload": { 17 | "psr-4": { 18 | "Psr\\Log\\": "Psr/Log/" 19 | } 20 | }, 21 | "extra": { 22 | "branch-alias": { 23 | "dev-master": "1.0.x-dev" 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/spatie/image/.editorconfig: -------------------------------------------------------------------------------- 1 | ; This file is for unifying the coding style for different editors and IDEs. 2 | ; More information at http://editorconfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | charset = utf-8 8 | indent_size = 4 9 | indent_style = space 10 | end_of_line = lf 11 | insert_final_newline = true 12 | trim_trailing_whitespace = true 13 | 14 | [*.md] 15 | trim_trailing_whitespace = false 16 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/spatie/image/.styleci.yml: -------------------------------------------------------------------------------- 1 | preset: laravel 2 | 3 | disabled: 4 | - single_class_element_per_statement 5 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/spatie/image/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Spatie bvba4 | 6 |5 | 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/spatie/image/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "spatie/image", 3 | "description": "Manipulate images with an expressive API", 4 | "keywords": [ 5 | "spatie", 6 | "image" 7 | ], 8 | "homepage": "https://github.com/spatie/image", 9 | "license": "MIT", 10 | "authors": [ 11 | { 12 | "name": "Freek Van der Herten", 13 | "email": "freek@spatie.be", 14 | "homepage": "https://spatie.be", 15 | "role": "Developer" 16 | } 17 | ], 18 | "require": { 19 | "php": "^7.0", 20 | "league/glide": "^1.2", 21 | "spatie/image-optimizer": "^1.0", 22 | "spatie/temporary-directory": "^1.0.0", 23 | "symfony/process": "^3.0|^4.0" 24 | }, 25 | "require-dev": { 26 | "larapack/dd": "^1.1", 27 | "phpunit/phpunit": "^6.0|^7.0", 28 | "symfony/var-dumper": "^3.2" 29 | }, 30 | "autoload": { 31 | "psr-4": { 32 | "Spatie\\Image\\": "src" 33 | } 34 | }, 35 | "autoload-dev": { 36 | "psr-4": { 37 | "Spatie\\Image\\Test\\": "tests" 38 | } 39 | }, 40 | "scripts": { 41 | "test": "vendor/bin/phpunit" 42 | }, 43 | "config": { 44 | "sort-packages": true 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/spatie/image/src/Exceptions/CouldNotConvert.php: -------------------------------------------------------------------------------- 1 | 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/spatie/temporary-directory/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "spatie/temporary-directory", 3 | "description": "Easily create, use and destroy temporary directories", 4 | "keywords": [ 5 | "spatie", 6 | "temporary-directory" 7 | ], 8 | "homepage": "https://github.com/spatie/temporary-directory", 9 | "license": "MIT", 10 | "authors": [ 11 | { 12 | "name": "Alex Vanderbist", 13 | "email": "alex@spatie.be", 14 | "homepage": "https://spatie.be", 15 | "role": "Developer" 16 | } 17 | ], 18 | "require": { 19 | "php": "^7.0" 20 | }, 21 | "require-dev": { 22 | "phpunit/phpunit": "^6.3" 23 | }, 24 | "autoload": { 25 | "psr-4": { 26 | "Spatie\\TemporaryDirectory\\": "src" 27 | } 28 | }, 29 | "autoload-dev": { 30 | "psr-4": { 31 | "Spatie\\TemporaryDirectory\\Test\\": "tests" 32 | } 33 | }, 34 | "scripts": { 35 | "test": "vendor/bin/phpunit" 36 | }, 37 | "config": { 38 | "sort-packages": true 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/symfony/process/.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | composer.lock 3 | phpunit.xml 4 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/symfony/process/Exception/ExceptionInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Process\Exception; 13 | 14 | /** 15 | * Marker Interface for the Process Component. 16 | * 17 | * @author Johannes M. Schmitt 18 | */ 19 | interface ExceptionInterface 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/symfony/process/Exception/InvalidArgumentException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Process\Exception; 13 | 14 | /** 15 | * InvalidArgumentException for the Process Component. 16 | * 17 | * @author Romain Neutron 18 | */ 19 | class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/symfony/process/Exception/LogicException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Process\Exception; 13 | 14 | /** 15 | * LogicException for the Process Component. 16 | * 17 | * @author Romain Neutron 18 | */ 19 | class LogicException extends \LogicException implements ExceptionInterface 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/symfony/process/Exception/RuntimeException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Process\Exception; 13 | 14 | /** 15 | * RuntimeException for the Process Component. 16 | * 17 | * @author Johannes M. Schmitt 18 | */ 19 | class RuntimeException extends \RuntimeException implements ExceptionInterface 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/symfony/process/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2004-2018 Fabien Potencier 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/symfony/process/README.md: -------------------------------------------------------------------------------- 1 | Process Component 2 | ================= 3 | 4 | The Process component executes commands in sub-processes. 5 | 6 | Resources 7 | --------- 8 | 9 | * [Documentation](https://symfony.com/doc/current/components/process.html) 10 | * [Contributing](https://symfony.com/doc/current/contributing/index.html) 11 | * [Report issues](https://github.com/symfony/symfony/issues) and 12 | [send Pull Requests](https://github.com/symfony/symfony/pulls) 13 | in the [main Symfony repository](https://github.com/symfony/symfony) 14 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/symfony/process/Tests/NonStopableProcess.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | /** 13 | * Runs a PHP script that can be stopped only with a SIGKILL (9) signal for 3 seconds. 14 | * 15 | * @args duration Run this script with a custom duration 16 | * 17 | * @example `php NonStopableProcess.php 42` will run the script for 42 seconds 18 | */ 19 | function handleSignal($signal) 20 | { 21 | switch ($signal) { 22 | case SIGTERM: 23 | $name = 'SIGTERM'; 24 | break; 25 | case SIGINT: 26 | $name = 'SIGINT'; 27 | break; 28 | default: 29 | $name = $signal.' (unknown)'; 30 | break; 31 | } 32 | 33 | echo "signal $name\n"; 34 | } 35 | 36 | pcntl_signal(SIGTERM, 'handleSignal'); 37 | pcntl_signal(SIGINT, 'handleSignal'); 38 | 39 | echo 'received '; 40 | 41 | $duration = isset($argv[1]) ? (int) $argv[1] : 3; 42 | $start = microtime(true); 43 | 44 | while ($duration > (microtime(true) - $start)) { 45 | usleep(10000); 46 | pcntl_signal_dispatch(); 47 | } 48 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/symfony/process/Tests/SignalListener.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | pcntl_signal(SIGUSR1, function () { echo 'SIGUSR1'; exit; }); 13 | 14 | echo 'Caught '; 15 | 16 | $n = 0; 17 | 18 | while ($n++ < 400) { 19 | usleep(10000); 20 | pcntl_signal_dispatch(); 21 | } 22 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/symfony/process/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "symfony/process", 3 | "type": "library", 4 | "description": "Symfony Process Component", 5 | "keywords": [], 6 | "homepage": "https://symfony.com", 7 | "license": "MIT", 8 | "authors": [ 9 | { 10 | "name": "Fabien Potencier", 11 | "email": "fabien@symfony.com" 12 | }, 13 | { 14 | "name": "Symfony Community", 15 | "homepage": "https://symfony.com/contributors" 16 | } 17 | ], 18 | "require": { 19 | "php": "^5.5.9|>=7.0.8" 20 | }, 21 | "autoload": { 22 | "psr-4": { "Symfony\\Component\\Process\\": "" }, 23 | "exclude-from-classmap": [ 24 | "/Tests/" 25 | ] 26 | }, 27 | "minimum-stability": "dev", 28 | "extra": { 29 | "branch-alias": { 30 | "dev-master": "3.4-dev" 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /practice/pic_classify/vendor/symfony/process/phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 31 | -------------------------------------------------------------------------------- /practice/pipeline.php: -------------------------------------------------------------------------------- 1 | train($samples, $targets); 30 | 31 | $predicted = $pipeline->predict([[0, 0, 0]]); 32 | var_dump($predicted); -------------------------------------------------------------------------------- /practice/stock.php: -------------------------------------------------------------------------------- 1 | train($samples, $labels); 44 | /* 45 | 如果我们想知道2017年张氏股的涨势是什么样的,我们用最小二乘法逼近线性模型来进行预测 46 | */ 47 | PFarr::dd($regression->predict([2017])); -------------------------------------------------------------------------------- /practice/svc.php: -------------------------------------------------------------------------------- 1 | train($samples, $labels); 12 | $pre_1 = $classifier->predict([3, 2]); 13 | // return 'b' 14 | $pre_2 = $classifier->predict([[3, 2], [1, 5]]); 15 | // return ['b', 'a'] 16 | \pf\arr\PFarr::dd($pre_2); -------------------------------------------------------------------------------- /practice/svr.php: -------------------------------------------------------------------------------- 1 | train($samples, $labels); 25 | //找一下 190, 85这个点 26 | PFarr::dd($regression->predict([190, 85])); -------------------------------------------------------------------------------- /practice/write.php: -------------------------------------------------------------------------------- 1 | getSamples(); 12 | $label = $dataset->getTargets(); 13 | 14 | $RandomForest = new RandomForest(); 15 | $RandomForest->train($sample,$label); 16 | 17 | $result = $RandomForest->predict($testset->getSamples()); //预测结果 18 | //var_dump($result); 19 | $csv=[]; 20 | $csv[0]['PassengerId']='树苗ID'; 21 | $csv[0]['Survived']='活下来了'; 22 | //遍历预测结果 23 | foreach ($result as $k=>$value){ 24 | $csv[$k+1]['PassengerId']=$k+892; 25 | $csv[$k+1]['Survived']=$value; 26 | } 27 | var_dump($csv);exit; 28 | $file = fopen('write.csv','a+b'); 29 | $data = $csv; 30 | foreach ($data as $value){ 31 | fputcsv($file,$value); 32 | } 33 | fclose( $file); -------------------------------------------------------------------------------- /vendor/autoload.php: -------------------------------------------------------------------------------- 1 | array($vendorDir . '/nancheng/pfinal-array/src'), 10 | 'Phpml\\' => array($vendorDir . '/php-ai/php-ml/src'), 11 | ); 12 | -------------------------------------------------------------------------------- /vendor/composer/autoload_static.php: -------------------------------------------------------------------------------- 1 | 11 | array ( 12 | 'pf\\arr\\' => 7, 13 | ), 14 | 'P' => 15 | array ( 16 | 'Phpml\\' => 6, 17 | ), 18 | ); 19 | 20 | public static $prefixDirsPsr4 = array ( 21 | 'pf\\arr\\' => 22 | array ( 23 | 0 => __DIR__ . '/..' . '/nancheng/pfinal-array/src', 24 | ), 25 | 'Phpml\\' => 26 | array ( 27 | 0 => __DIR__ . '/..' . '/php-ai/php-ml/src', 28 | ), 29 | ); 30 | 31 | public static function getInitializer(ClassLoader $loader) 32 | { 33 | return \Closure::bind(function () use ($loader) { 34 | $loader->prefixLengthsPsr4 = ComposerStaticInit1ea4b2bb20f5bb883fbdb6dd3afbfada::$prefixLengthsPsr4; 35 | $loader->prefixDirsPsr4 = ComposerStaticInit1ea4b2bb20f5bb883fbdb6dd3afbfada::$prefixDirsPsr4; 36 | 37 | }, null, ClassLoader::class); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /vendor/nancheng/pfinal-array/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 |12 | 14 | 15 |13 | 16 | 20 | 21 |17 | 19 |./Tests/ 18 |22 | 30 |23 | 29 |./ 24 |25 | 28 |./Tests 26 |./vendor 27 |2 | -------------------------------------------------------------------------------- /vendor/nancheng/pfinal-array/.idea/dictionaries/qiuzi.xml: -------------------------------------------------------------------------------- 1 |3 | 2 | -------------------------------------------------------------------------------- /vendor/nancheng/pfinal-array/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 |3 | 3 | -------------------------------------------------------------------------------- /vendor/nancheng/pfinal-array/.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 |4 | 6 |5 | 2 | -------------------------------------------------------------------------------- /vendor/nancheng/pfinal-array/.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 |3 | 4 | 13 |5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |2 | -------------------------------------------------------------------------------- /vendor/nancheng/pfinal-array/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 |3 | 4 | 5 | 7 |6 | 3 | -------------------------------------------------------------------------------- /vendor/nancheng/pfinal-array/.idea/pfinal-array.iml: -------------------------------------------------------------------------------- 1 | 2 |4 | 8 |5 | 7 |6 | 3 | -------------------------------------------------------------------------------- /vendor/nancheng/pfinal-array/.idea/php.xml: -------------------------------------------------------------------------------- 1 | 2 |4 | 8 |5 | 6 | 7 | 3 | -------------------------------------------------------------------------------- /vendor/nancheng/pfinal-array/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 |4 | 8 |5 | 7 |6 | 3 | -------------------------------------------------------------------------------- /vendor/nancheng/pfinal-array/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nancheng/pfinal-array", 3 | "description": "This is a PHP array manipulation middleware", 4 | "authors": [ 5 | { 6 | "name": "小九", 7 | "email": "Lampxiezi@163.com", 8 | "homepage": "http://friday-go.cc/" 9 | } 10 | ], 11 | "homepage":"https://github.com/Neroxiezi/pfinal-array", 12 | "license": "MIT", 13 | "keywords": [ 14 | "pfinal", 15 | "南丞", 16 | "Q哥", 17 | "array", 18 | "php-array" 19 | ], 20 | 21 | "require": { 22 | "php": ">=5.4.0" 23 | }, 24 | "autoload": { 25 | "psr-4": { 26 | "pf\\arr\\": "src/" 27 | } 28 | }, 29 | "autoload-dev": { 30 | "psr-4": { 31 | "example\\": "example" 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /vendor/nancheng/pfinal-array/example/arrayTest.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmlic/PHP-ML-study/700b10a92e3d45cb794458db6547e73ac9082e2a/vendor/nancheng/pfinal-array/example/arrayTest.php -------------------------------------------------------------------------------- /vendor/nancheng/pfinal-array/src/PFarr.php: -------------------------------------------------------------------------------- 1 | pf_array_link = new Base(); 11 | return $this; 12 | } 13 | 14 | public function __call($method, $params) 15 | { 16 | if (is_null($this->pf_array_link)) { 17 | $this->driver(); 18 | } 19 | if (method_exists($this->pf_array_link, $method)) { 20 | return call_user_func_array([$this->pf_array_link, $method], $params); 21 | } 22 | } 23 | 24 | public static function single() 25 | { 26 | static $pf_array_link; 27 | if (is_null($pf_array_link)) { 28 | $pf_array_link = new static(); 29 | } 30 | return $pf_array_link; 31 | } 32 | 33 | public static function __callStatic($name, $arguments) 34 | { 35 | return call_user_func_array([static::single(), $name], $arguments); 36 | } 37 | } -------------------------------------------------------------------------------- /vendor/nancheng/pfinal-array/src/build/PFArrToCsv.php: -------------------------------------------------------------------------------- 1 | delimiter = $delimiter; 12 | $this->text_separator = $text_separator; 13 | $this->replace_text_separator = $replace_text_separator; 14 | $this->line_delimiter = $line_delimiter; 15 | return $this; 16 | } 17 | public function convert($input) { 18 | $lines = array(); 19 | foreach ($input as $v) { 20 | $lines[] = $this->convertLine($v); 21 | } 22 | return implode($this->line_delimiter, $lines); 23 | } 24 | private function convertLine($line) { 25 | $csv_line = array(); 26 | foreach ($line as $v) { 27 | $csv_line[] = is_array($v) ? 28 | $this->convertLine($v) : 29 | $this->text_separator . str_replace($this->text_separator, $this->replace_text_separator, $v) . $this->text_separator; 30 | } 31 | return implode($this->delimiter, $csv_line); 32 | } 33 | } --------------------------------------------------------------------------------4 | 6 |5 |