Completed
Push — master ( cb5a99...e603d6 )
by Arkadiusz
06:54
created
src/Phpml/Classification/NaiveBayes.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
                 }, $db);
68 68
             } else {
69 69
                 $this->mean[$label][$i] = Mean::arithmetic($values);
70
-				// Add epsilon in order to avoid zero stdev
70
+                // Add epsilon in order to avoid zero stdev
71 71
                 $this->std[$label][$i] = 1e-10 + StandardDeviation::population($values, false);
72 72
             }
73 73
         }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 
76 76
     /**
77 77
      * Calculates the probability P(label|sample_n)
78
-	 *
78
+     *
79 79
      * @param array $sample
80 80
      * @param int $feature
81 81
      * @param string $label
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
         $mean= $this->mean[$label][$feature];
95 95
         // Calculate the probability density by use of normal/Gaussian distribution
96 96
         // Ref: https://en.wikipedia.org/wiki/Normal_distribution
97
-		//
98
-		// In order to avoid numerical errors because of small or zero values,
99
-		// some libraries adopt taking log of calculations such as
100
-		// scikit-learn did.
101
-		// (See : https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/naive_bayes.py)
102
-		$pdf  =  -0.5 * log(2.0 * pi() * $std * $std);
103
-		$pdf -= 0.5 * pow($value - $mean, 2) / ($std * $std);
104
-		return $pdf;
97
+        //
98
+        // In order to avoid numerical errors because of small or zero values,
99
+        // some libraries adopt taking log of calculations such as
100
+        // scikit-learn did.
101
+        // (See : https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/naive_bayes.py)
102
+        $pdf  =  -0.5 * log(2.0 * pi() * $std * $std);
103
+        $pdf -= 0.5 * pow($value - $mean, 2) / ($std * $std);
104
+        return $pdf;
105 105
     }
106 106
 
107 107
     /**
Please login to merge, or discard this patch.