Skip to content

Instantly share code, notes, and snippets.

@shubham0204
Created May 19, 2019 12:49
Show Gist options
  • Save shubham0204/01e5db8a276705852844557fc366c537 to your computer and use it in GitHub Desktop.
Save shubham0204/01e5db8a276705852844557fc366c537 to your computer and use it in GitHub Desktop.
private fun findProbabilityGivenClass( x : String , classVocab : Array<String> ) : Float {
val x_count = classVocab.count { it.contains(x) or x.contains(it) }.toFloat()
val class_count = classVocab.count().toFloat()
return (( x_count / class_count ) + 1)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment