|
@@ -120,7 +120,7 @@ discard block |
|
|
block discarded – undo |
|
120
|
120
|
$this->dataType[$label][$i] = self::NOMINAL; |
|
121
|
121
|
$this->discreteProb[$label][$i] = array_count_values($values); |
|
122
|
122
|
$db = &$this->discreteProb[$label][$i]; |
|
123
|
|
- $db = array_map(function ($el) use ($numValues) { |
|
|
123
|
+ $db = array_map(function($el) use ($numValues) { |
|
124
|
124
|
return $el / $numValues; |
|
125
|
125
|
}, $db); |
|
126
|
126
|
} else { |
|
@@ -136,7 +136,7 @@ discard block |
|
|
block discarded – undo |
|
136
|
136
|
*/ |
|
137
|
137
|
private function sampleProbability(array $sample, int $feature, string $label): float |
|
138
|
138
|
{ |
|
139
|
|
- $value = (isset($sample[$feature]))? $sample[$feature] : null; |
|
|
139
|
+ $value = (isset($sample[$feature])) ? $sample[$feature] : null; |
|
140
|
140
|
if ($this->dataType[$label][$feature] == self::NOMINAL) { |
|
141
|
141
|
if (!isset($this->discreteProb[$label][$feature][$value]) || |
|
142
|
142
|
$this->discreteProb[$label][$feature][$value] == 0) { |
Please login to merge, or discard this patch.