We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f3e0d92 commit de4d302Copy full SHA for de4d302
src/Classifiers/NaiveBayes.php
@@ -254,7 +254,7 @@ public function partial(Dataset $dataset) : void
254
}
255
256
257
- $total = array_sum($columnCounts) + (count($columnCounts) * $this->smoothing);
+ $total = array_sum($columnCounts) + $this->smoothing * count($columnCounts);
258
259
$probs = [];
260
@@ -275,8 +275,6 @@ public function partial(Dataset $dataset) : void
275
if ($this->fitPriors) {
276
$total = array_sum($this->classCounts);
277
278
- $this->logPriors = [];
279
-
280
foreach ($this->classCounts as $class => $weight) {
281
$this->logPriors[$class] = log($weight / $total);
282
0 commit comments