Created
September 8, 2013 07:39
-
-
Save Alrecenk/6482692 to your computer and use it in GitHub Desktop.
Naive Bayes Example Calculation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public double ProbabilityOfInputIfPositive(double in[]){ | |
double prob = 1/Math.sqrt(2 * Math.PI) ; | |
for(int j=0; j<in.length;j++){ | |
prob*= Math.exp(- (in[j]-posmean[j])*(in[j]-posmean[j]) / (2*posvariance[j]) ) ; | |
} | |
return prob ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment