Commit Graph

196 Commits

Author SHA1 Message Date
Arkadiusz Kondas
a36fe086d3
Add performance test for LeastSquares (#263)
* Install phpbench 🚀

* Add first benchmark for LeastSquares

* Update README and CONTRIBUTING guide

* Fix typo
2018-03-10 21:48:16 +01:00
Ivana Momcilovic
af2d732194 KMeans associative clustering (#262)
* KMeans associative clustering added

* fix travis error

* KMeans will return provided keys as point label if they are provided

* fix travis

* fix travis
2018-03-08 22:27:16 +01:00
Marcin Michalski
e156076539 Add DecisionTreeLeaf.getNodeImpurityDecrease test (#261) 2018-03-07 23:16:25 +01:00
Yuji Uchiyama
66ca874062 Throw proper exception (#259)
* Throw proper exception

* Fix coding style
2018-03-06 23:26:36 +01:00
Marcin Michalski
a40c50b48b Add Optimizer tests and remove initialTheta (#252)
* Add  Optimizer tests

* Remove Optimizer.initialTheta and rename Optimizer.setInitialTheta to setTheta
2018-03-04 22:44:22 +01:00
Marcin Michalski
55749c7c92 Add Cluster tests (#254) 2018-03-04 17:06:46 +01:00
Marcin Michalski
33efab20a5 Add LUDecomposition triangular factor tests (#253) 2018-03-04 17:05:25 +01:00
Marcin Michalski
941d240ab6 Add RandomForest exception tests (#251) 2018-03-04 17:02:36 +01:00
Arkadiusz Kondas
8976047cbc
Add removeColumns function to ArrayDataset (#249)
* Add removeColumns function to ArrayDataset

* Add removeColumns to docs

* Fix cs
2018-03-03 16:04:21 +01:00
Yuji Uchiyama
af9ccfe722 Add tests for LogisticRegression (#248) 2018-03-03 11:19:58 +01:00
Arkadiusz Kondas
d188790276
Add MLP partial train test after restore from file (#243) 2018-02-26 00:02:04 +01:00
Marcin Michalski
9e375ca544 Ensure DataTransformer::testSet samples array is not empty (#204) 2018-02-25 22:56:36 +01:00
Yuji Uchiyama
4562f1dfc9 Add a SvmDataset class for SVM-Light (or LibSVM) format files (#237)
* Add data loader for svm format

* Add tests for error cases

* Set proper exception messages

* Add documents

* Add error checking code for invalid column format

* Add missing documents
2018-02-24 11:17:35 +01:00
Arkadiusz Kondas
a96f03e8dd
Fix Optimizer initial theta randomization (#239)
* Fix Optimizer initial theta randomization

* Add more tests for LUDecomposition and FuzzyCMeans
2018-02-23 23:05:46 +01:00
Yuji Uchiyama
add00c6108 Fix apriori keys (#238)
* Add test to check keys of rules

* Reindex after array_filter/array_unique in Apriori
2018-02-22 17:02:55 +01:00
Arkadiusz Kondas
0a15561352
Fix KMeans and EigenvalueDecomposition (#235)
* Fix kmeans cluster and eigenvalue decomposition

* Fix kmeans space

* Fix code style
2018-02-18 00:09:24 +01:00
Arkadiusz Kondas
16dc16b0d9
Add phpstan strict rules (#233)
* Add phpstan strict rules

* Fix travis coveralls

* Add phpstan-phpunit strict rules

* Fix eigen decomposition test name and phpstan ingored error
2018-02-16 07:25:24 +01:00
Marcin Michalski
6ac61a860c Fix 'toSmall' typo (#234) 2018-02-15 18:14:06 +01:00
Arkadiusz Kondas
451f84c2e6 Add SelectKBest docs 2018-02-14 20:34:53 +01:00
Arkadiusz Kondas
b4b190de7f Fix pipeline transformers 2018-02-14 20:34:53 +01:00
Arkadiusz Kondas
998879b6fc Switch SelectKBest constructor parameters 2018-02-14 20:34:53 +01:00
Arkadiusz Kondas
9e5b3a0c69 Implement first regression scoring function UnivariateLinearRegression 2018-02-14 20:34:53 +01:00
Arkadiusz Kondas
fbf84ca95f Implement SelectKBest algo for feature selection 2018-02-14 20:34:53 +01:00
Arkadiusz Kondas
52c9ba8291
Fix: phpunit include tests path (#230)
* Fix phpunit include path

* Add tests for Covariance
2018-02-11 18:17:50 +01:00
Yuji Uchiyama
53f8a89556 Fix support of a rule in Apriori (#229)
* Clean up test code

* Add test to check support and confidence (failed due to a bug)

* Fix support value of rules
2018-02-11 12:42:46 +01:00
Arkadiusz Kondas
3ba35918a3
Implement VarianceThreshold - simple baseline approach to feature selection. (#228)
* Add sum of squares deviations

* Calculate population variance

* Add VarianceThreshold - feature selection transformer

* Add docs about VarianceThreshold

* Add missing code for pipeline usage
2018-02-10 18:07:09 +01:00
Andreas Möller
4b5d57fd6f Enhancement: Flatten directory structure (#220) 2018-02-10 12:08:58 +01:00
Yuji Uchiyama
71cc633c8e Fix apriori generates an empty array as a part of the frequent item sets (#224) 2018-02-07 10:02:38 +01:00
Yuji Uchiyama
ec091b5ea3 Support probability estimation in SVC (#218)
* Add test for svm model with probability estimation

* Extract buildPredictCommand method

* Fix test to use PHP_EOL

* Add predictProbability method (not completed)

* Add test for DataTransformer::predictions

* Fix SVM to use PHP_EOL

* Support probability estimation in SVM

* Add documentation

* Add InvalidOperationException class

* Throw InvalidOperationException before executing libsvm if probability estimation is not supported
2018-02-06 20:39:25 +01:00
Jonathan Baldie
c32bf3fe2b Configure an Activation Function per hidden layer (#208)
* ability to specify per-layer activation function

* some tests for new addition to layer

* appease style CI whitespace issue

* more flexible addition of layers, and developer can pass Layer object in manually

* new test for layer object in mlp constructor

* documentation for added MLP functionality
2018-02-01 23:15:36 +01:00
Jonathan Baldie
e318921076 Fix string representation of integer labels issue in NaiveBayes (#206)
* Update NaiveBayes.php

This fixes an issue using string labels that are string representations of integers, e.g. "1998" getting cast to (int)1998.

* Update NaiveBayes.php

fixes superfluous whitespace error

* added tests for naive bayes with numeric labels

* added array_unique

* nested array_flips for speed

* nested the array flips inside the array map

* to appear style CI test
2018-01-31 21:44:44 +01:00
Yuji Uchiyama
554c86af68 Choose averaging method in classification report (#205)
* Fix testcases of ClassificationReport

* Fix averaging method in ClassificationReport

* Fix divided by zero if labels are empty

* Fix calculation of f1score

* Add averaging methods (not completed)

* Implement weighted average method

* Extract counts to properties

* Fix default to macro average

* Implement micro average method

* Fix style

* Update docs

* Fix styles
2018-01-29 18:06:21 +01:00
Marcin Michalski
ba7114a3f7 Add libsvm exception tests (#202) 2018-01-26 22:07:22 +01:00
Arkadiusz Kondas
7435bece34
Add test for Pipeline save and restore with ModelManager (#191) 2018-01-12 10:54:20 +01:00
Yuji Uchiyama
d953ef6bfc Fix the implementation of conjugate gradient method (#184)
* Add unit tests for optimizers

* Fix ConjugateGradient

* Fix coding style

* Fix namespace
2018-01-12 10:53:43 +01:00
David Monllaó
e83f7b95d5 Fix activation functions support (#163)
- Backpropagation using the neuron activation functions derivative
- instead of hardcoded sigmoid derivative
- Added missing activation functions derivatives
- Sigmoid forced for the output layer
- Updated ThresholdedReLU default threshold to 0 (acts as a ReLU)
- Unit tests for derivatives
- Unit tests for classifiers using different activation functions
- Added missing docs
2018-01-09 11:09:59 +01:00
Yuji Uchiyama
9938cf2911 Rewrite DBSCAN (#185)
* Add testcases to DBSCAN

* Fix DBSCAN implementation

* Refactoring DBSCAN implementation

* Fix coding style
2018-01-09 10:53:02 +01:00
Tomáš Votruba
6660645ecd Update dev dependencies (#187)
* composer: update dev dependencies

* phpstan fixes

* phpstan fixes

* phpstan fixes

* phpstan fixes

* drop probably forgotten humbug configs

* apply cs

* fix cs bug

* compsoer: add coding standard and phsptan dev friendly scripts

* ecs: add skipped errors

* cs: fix PHP 7.1

* fix cs

* ecs: exclude strict fixer that break code

* ecs: cleanup commented sets

* travis: use composer scripts for testing to prevent duplicated setup
2018-01-06 21:25:47 +01:00
Tomáš Votruba
a348111e97 Add PHPStan and level to max (#168)
* tests: update to PHPUnit 6.0 with rector

* fix namespaces on tests

* composer + tests: use standard test namespace naming

* update travis

* resolve conflict

* phpstan lvl 2

* phpstan lvl 3

* phpstan lvl 4

* phpstan lvl 5

* phpstan lvl 6

* phpstan lvl 7

* level max

* resolve conflict

* [cs] clean empty docs

* composer: bump to PHPUnit 6.4

* cleanup

* composer + travis: add phpstan

* phpstan lvl 1

* composer: update dev deps

* phpstan fixes

* update Contributing with new tools

* docs: link fixes, PHP version update

* composer: drop php-cs-fixer, cs already handled by ecs

* ecs: add old set rules

* [cs] apply rest of rules
2018-01-06 13:09:33 +01:00
David Monllaó
c4ad117d28 Ability to update learningRate in MLP (#160)
* Allow people to update the learning rate

* Test for learning rate setter
2017-12-05 21:09:06 +01:00
Yuji Uchiyama
c4f58f7f6f Fix logistic regression implementation (#169)
* Fix target value of LogisticRegression

* Fix probability calculation in LogisticRegression

* Change the default cost function to log-likelihood

* Remove redundant round function

* Fix for coding standard
2017-12-05 12:03:55 +01:00
Tomáš Votruba
946fbbc521 Tests: use PHPUnit (6.4) exception methods (#165)
* tests: update to PHPUnit 6.0 with rector

* [cs] clean empty docs

* composer: bump to PHPUnit 6.4

* tests: use class references over strings

* cleanup
2017-11-28 08:00:13 +01:00
Tomáš Votruba
726cf4cddf Added EasyCodingStandard + lots of code fixes (#156)
* travis: move coveralls here, decouple from package

* composer: use PSR4

* phpunit: simpler config

* travis: add ecs run

* composer: add ecs dev

* use standard vendor/bin directory for dependency bins, confuses with local bins and require gitignore handling

* ecs: add PSR2

* [cs] PSR2 spacing fixes

* [cs] PSR2 class name fix

* [cs] PHP7 fixes - return semicolon spaces, old rand functions, typehints

* [cs] fix less strict typehints

* fix typehints to make tests pass

* ecs: ignore typehint-less elements

* [cs] standardize arrays

* [cs] standardize docblock, remove unused comments

* [cs] use self where possible

* [cs] sort class elements, from public to private

* [cs] do not use yoda (found less yoda-cases, than non-yoda)

* space

* [cs] do not assign in condition

* [cs] use namespace imports if possible

* [cs] use ::class over strings

* [cs] fix defaults for arrays properties, properties and constants single spacing

* cleanup ecs comments

* [cs] use item per line in multi-items array

* missing line

* misc

* rebase
2017-11-22 22:16:10 +01:00
David Monllaó
333598b472 Fix backpropagation random error (#157) 2017-11-20 23:11:21 +01:00
Tomáš Votruba
653c7c772d Upgrade to PHP 7.1 (#150)
* upgrade to PHP 7.1

* bump travis and composer to PHP 7.1

* fix tests
2017-11-14 21:21:23 +01:00
Tomáš Votruba
d85bfed468 [cs] remove more unused comments (#146)
* [cs] remove more unused comments

* [cs] remove unused array phpdocs

* [cs] remove empty lines in docs

* [cs] space-proof useless docs

* [cs] remove empty @param lines

* [cs] remove references arrays
2017-11-13 11:42:40 +01:00
Tomáš Votruba
f4650c696c [coding standard] fix imports order and drop unused docs typehints (#145)
* fix imports order

* drop unused docs typehints, make use of return types where possible
2017-11-06 08:56:37 +01:00
Marcin Michalski
11d05ce89d Comparison - replace eval (#130)
* Replace eval with strategy

* Use Factory Pattern, add tests

* Add missing dockblocks

* Replace strategy with simple object
2017-10-24 18:59:12 +02:00
Maxim Kasatkin
b48b82bd34 DBSCAN fix for associative keys and array_merge performance optimization (#139) 2017-10-18 10:59:37 +02:00
Marcin Michalski
61d2b7d115 Ensure user-provided SupportVectorMachine paths are valid (#126) 2017-09-02 22:44:19 +02:00