Skip to content

Commit

Permalink
fix errors on hhvm with float casting
Browse files Browse the repository at this point in the history
  • Loading branch information
akondas committed Jul 7, 2016
1 parent 6c7416a commit 4aa9702
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Phpml/FeatureExtraction/TfIdfTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function fit(array $samples)

$count = count($samples);
foreach ($this->idf as &$value) {
$value = log($count / $value, 10);
$value = log(floatval($count / $value), 10.0);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Phpml/Preprocessing/Normalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private function normalizeL2(array &$sample)
foreach ($sample as $feature) {
$norm2 += $feature * $feature;
}
$norm2 = sqrt($norm2);
$norm2 = sqrt(floatval($norm2));

if (0 == $norm2) {
$sample = array_fill(0, count($sample), 1);
Expand Down

0 comments on commit 4aa9702

Please sign in to comment.