Skip to content

Instantly share code, notes, and snippets.

@Alrecenk
Created September 8, 2013 07:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Alrecenk/6482692 to your computer and use it in GitHub Desktop.
Save Alrecenk/6482692 to your computer and use it in GitHub Desktop.
Naive Bayes Example Calculation
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