Skip to content

Instantly share code, notes, and snippets.

@shubham0204
Created May 19, 2019 12:54
Show Gist options
  • Save shubham0204/a6e297e250033244c62c0b50896b3879 to your computer and use it in GitHub Desktop.
Save shubham0204/a6e297e250033244c62c0b50896b3879 to your computer and use it in GitHub Desktop.
private fun findProbabilityGivenSample( document : String , classVocab : Array<String> ) : Float {
val tokens = getTokens( document )
var probability_given_class = 1.0f
for ( token in tokens ) {
probability_given_class *= findProbabilityGivenClass( token , classVocab )
}
return probability_given_class * findClassProbability( positiveBagOfWords , negativeBagOfWords , classVocab )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment