Skip to content

Commit 571c02d

Browse files
authored
Update NumericalNaiveBayes.py
1 parent c1d727d commit 571c02d

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

Classifiers/Naive Bayes/Numerical/NumericalNaiveBayes.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import math;
33

44

5-
def Gaussian(mean,stDev,x):
6-
g = 1/(math.sqrt(2*math.pi)*stDev)*math.e**(-0.5*(float(x-mean)/stDev)**2);
5+
def Gaussian(mean, stDev, x):
6+
g = 1/(math.sqrt(2*math.pi)*stDev) * math.e**(-0.5*(float(x-mean)/stDev)**2);
77
return g;
88

99
def Classifier(Evidence):
@@ -70,11 +70,7 @@ def Classifier(Evidence):
7070

7171

7272
#Read data from file
73-
data = DataReader.Read('data.txt'); #Returns a tuple
74-
Classes = data[0]; #The first item of the tuple is the Classes data
75-
Features = data[1]; #The second item is the Features data
76-
P = data[2]; #The third is the probabilities
77-
n = data[3]; #The fourth is the length of our data set
73+
Classes, Features, P, n = DataReader.Read('data.txt'); #Returns a tuple
7874

7975
#Run classifier with the evidence list
80-
Classifier((('Height',170),('Weight',65)));
76+
Classifier((('Height', 170), ('Weight', 65)));

0 commit comments

Comments
 (0)