mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2024-09-28 15:09:01 +00:00
php-cs-fixer
This commit is contained in:
parent
424519cd83
commit
601ff884e8
@ -21,5 +21,4 @@ class NormalizerException extends \Exception
|
|||||||
{
|
{
|
||||||
return new self('Fit is not allowed for this preprocessor.');
|
return new self('Fit is not allowed for this preprocessor.');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ class TfIdfTransformer implements Transformer
|
|||||||
*/
|
*/
|
||||||
public function __construct(array $samples = null)
|
public function __construct(array $samples = null)
|
||||||
{
|
{
|
||||||
if($samples) {
|
if ($samples) {
|
||||||
$this->fit($samples);
|
$this->fit($samples);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ class TokenCountVectorizer implements Transformer
|
|||||||
|
|
||||||
foreach ($tokens as $token) {
|
foreach ($tokens as $token) {
|
||||||
$index = $this->getTokenIndex($token);
|
$index = $this->getTokenIndex($token);
|
||||||
if(false !== $index) {
|
if (false !== $index) {
|
||||||
$this->updateFrequency($token);
|
$this->updateFrequency($token);
|
||||||
if (!isset($counts[$index])) {
|
if (!isset($counts[$index])) {
|
||||||
$counts[$index] = 0;
|
$counts[$index] = 0;
|
||||||
|
@ -27,14 +27,14 @@ class Imputer implements Preprocessor
|
|||||||
private $axis;
|
private $axis;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var $samples
|
* @var
|
||||||
*/
|
*/
|
||||||
private $samples;
|
private $samples;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $missingValue
|
* @param mixed $missingValue
|
||||||
* @param Strategy $strategy
|
* @param Strategy $strategy
|
||||||
* @param int $axis
|
* @param int $axis
|
||||||
* @param array|null $samples
|
* @param array|null $samples
|
||||||
*/
|
*/
|
||||||
public function __construct($missingValue = null, Strategy $strategy, int $axis = self::AXIS_COLUMN, array $samples = [])
|
public function __construct($missingValue = null, Strategy $strategy, int $axis = self::AXIS_COLUMN, array $samples = [])
|
||||||
|
@ -6,7 +6,6 @@ namespace Phpml;
|
|||||||
|
|
||||||
interface Transformer
|
interface Transformer
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $samples
|
* @param array $samples
|
||||||
*/
|
*/
|
||||||
|
@ -78,7 +78,6 @@ class TokenCountVectorizerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$vectorizer->transform($samples);
|
$vectorizer->transform($samples);
|
||||||
$this->assertEquals($tokensCounts, $samples);
|
$this->assertEquals($tokensCounts, $samples);
|
||||||
|
|
||||||
|
|
||||||
// word at least once in all samples
|
// word at least once in all samples
|
||||||
$samples = [
|
$samples = [
|
||||||
'Lorem ipsum dolor sit amet',
|
'Lorem ipsum dolor sit amet',
|
||||||
|
@ -172,5 +172,4 @@ class ImputerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$this->assertEquals($imputeData, $data, '', $delta = 0.01);
|
$this->assertEquals($imputeData, $data, '', $delta = 0.01);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -79,5 +79,4 @@ class NormalizerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$this->assertEquals($normalized, $samples, '', $delta = 0.01);
|
$this->assertEquals($normalized, $samples, '', $delta = 0.01);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user