mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2024-11-25 06:17:34 +00:00
fix errors on hhvm with float casting
This commit is contained in:
parent
6c7416a9c4
commit
4aa9702943
@ -32,7 +32,7 @@ class TfIdfTransformer implements Transformer
|
||||
|
||||
$count = count($samples);
|
||||
foreach ($this->idf as &$value) {
|
||||
$value = log($count / $value, 10);
|
||||
$value = log(floatval($count / $value), 10.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ class Normalizer implements Preprocessor
|
||||
foreach ($sample as $feature) {
|
||||
$norm2 += $feature * $feature;
|
||||
}
|
||||
$norm2 = sqrt($norm2);
|
||||
$norm2 = sqrt(floatval($norm2));
|
||||
|
||||
if (0 == $norm2) {
|
||||
$sample = array_fill(0, count($sample), 1);
|
||||
|
Loading…
Reference in New Issue
Block a user