mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2024-11-26 23:06:31 +00:00
Update phpunit, phpbench, easy coding standard (#415)
This commit is contained in:
parent
7d5c6b15a4
commit
0d59441329
@ -23,13 +23,12 @@
|
|||||||
"php": "^7.2"
|
"php": "^7.2"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpbench/phpbench": "^0.14.0",
|
"phpbench/phpbench": "^0.16.0",
|
||||||
"phpstan/phpstan-phpunit": "^0.11",
|
"phpstan/phpstan-phpunit": "^0.11",
|
||||||
"phpstan/phpstan-shim": "^0.11",
|
"phpstan/phpstan-shim": "^0.11",
|
||||||
"phpstan/phpstan-strict-rules": "^0.11",
|
"phpstan/phpstan-strict-rules": "^0.11",
|
||||||
"phpunit/phpunit": "^8.0",
|
"phpunit/phpunit": "^8.0",
|
||||||
"symplify/coding-standard": "^5.1",
|
"symplify/easy-coding-standard": "^6.0"
|
||||||
"symplify/easy-coding-standard": "^5.1"
|
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"preferred-install": "dist",
|
"preferred-install": "dist",
|
||||||
|
1896
composer.lock
generated
1896
composer.lock
generated
File diff suppressed because it is too large
Load Diff
8
ecs.yml
8
ecs.yml
@ -1,8 +1,8 @@
|
|||||||
imports:
|
imports:
|
||||||
- { resource: 'vendor/symplify/easy-coding-standard/config/psr2.yml' }
|
- { resource: 'vendor/symplify/easy-coding-standard/config/set/psr2.yaml' }
|
||||||
- { resource: 'vendor/symplify/easy-coding-standard/config/php71.yml' }
|
- { resource: 'vendor/symplify/easy-coding-standard/config/set/php71.yaml' }
|
||||||
- { resource: 'vendor/symplify/easy-coding-standard/config/clean-code.yml' }
|
- { resource: 'vendor/symplify/easy-coding-standard/config/set/clean-code.yaml' }
|
||||||
- { resource: 'vendor/symplify/easy-coding-standard/config/common.yml' }
|
- { resource: 'vendor/symplify/easy-coding-standard/config/set/common.yaml' }
|
||||||
|
|
||||||
services:
|
services:
|
||||||
# spacing
|
# spacing
|
||||||
|
@ -201,7 +201,7 @@ class Matrix
|
|||||||
*/
|
*/
|
||||||
public function add(self $other): self
|
public function add(self $other): self
|
||||||
{
|
{
|
||||||
return $this->_add($other);
|
return $this->sum($other);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -209,7 +209,7 @@ class Matrix
|
|||||||
*/
|
*/
|
||||||
public function subtract(self $other): self
|
public function subtract(self $other): self
|
||||||
{
|
{
|
||||||
return $this->_add($other, -1);
|
return $this->sum($other, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function inverse(): self
|
public function inverse(): self
|
||||||
@ -297,7 +297,7 @@ class Matrix
|
|||||||
/**
|
/**
|
||||||
* Element-wise addition or substraction depending on the given sign parameter
|
* Element-wise addition or substraction depending on the given sign parameter
|
||||||
*/
|
*/
|
||||||
private function _add(self $other, int $sign = 1): self
|
private function sum(self $other, int $sign = 1): self
|
||||||
{
|
{
|
||||||
$a1 = $this->toArray();
|
$a1 = $this->toArray();
|
||||||
$a2 = $other->toArray();
|
$a2 = $other->toArray();
|
||||||
|
@ -32,8 +32,8 @@ class ModelManager
|
|||||||
throw new FileException(sprintf('File "%s" cannot be opened.', basename($filepath)));
|
throw new FileException(sprintf('File "%s" cannot be opened.', basename($filepath)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$object = unserialize((string) file_get_contents($filepath), [Estimator::class]);
|
$object = unserialize((string) file_get_contents($filepath));
|
||||||
if ($object === false) {
|
if ($object === false || !$object instanceof Estimator) {
|
||||||
throw new SerializeException(sprintf('"%s" cannot be unserialized.', basename($filepath)));
|
throw new SerializeException(sprintf('"%s" cannot be unserialized.', basename($filepath)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +121,9 @@ class BaggingTest extends TestCase
|
|||||||
protected function getAvailableBaseClassifiers(): array
|
protected function getAvailableBaseClassifiers(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
DecisionTree::class => ['depth' => 5],
|
DecisionTree::class => [
|
||||||
|
'depth' => 5,
|
||||||
|
],
|
||||||
NaiveBayes::class => [],
|
NaiveBayes::class => [],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,10 @@ class RandomForestTest extends BaggingTest
|
|||||||
|
|
||||||
protected function getAvailableBaseClassifiers(): array
|
protected function getAvailableBaseClassifiers(): array
|
||||||
{
|
{
|
||||||
return [DecisionTree::class => ['depth' => 5]];
|
return [
|
||||||
|
DecisionTree::class => [
|
||||||
|
'depth' => 5,
|
||||||
|
],
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,11 +41,9 @@ class SynapseTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int|float $output
|
|
||||||
*
|
|
||||||
* @return Neuron|MockObject
|
* @return Neuron|MockObject
|
||||||
*/
|
*/
|
||||||
private function getNodeMock($output = 1)
|
private function getNodeMock(float $output = 1.)
|
||||||
{
|
{
|
||||||
$node = $this->getMockBuilder(Neuron::class)->getMock();
|
$node = $this->getMockBuilder(Neuron::class)->getMock();
|
||||||
$node->method('getOutput')->willReturn($output);
|
$node->method('getOutput')->willReturn($output);
|
||||||
|
@ -56,7 +56,7 @@ class NeuronTest extends TestCase
|
|||||||
/**
|
/**
|
||||||
* @return Synapse|MockObject
|
* @return Synapse|MockObject
|
||||||
*/
|
*/
|
||||||
private function getSynapseMock(int $output = 2)
|
private function getSynapseMock(float $output = 2.)
|
||||||
{
|
{
|
||||||
$synapse = $this->getMockBuilder(Synapse::class)->disableOriginalConstructor()->getMock();
|
$synapse = $this->getMockBuilder(Synapse::class)->disableOriginalConstructor()->getMock();
|
||||||
$synapse->method('getOutput')->willReturn($output);
|
$synapse->method('getOutput')->willReturn($output);
|
||||||
|
Loading…
Reference in New Issue
Block a user