wink-naive-bayes-text-classifier
Advanced tools
Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "wink-naive-bayes-text-classifier", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Configurable Naive Bayes Classifier for text with cross-validation support", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -10,5 +10,5 @@ | ||
**wink-naive-bayes-text-classifier** is a part of **[wink](https://www.npmjs.com/~sanjaya)**, which is a family of Machine Learning NPM packages. They consist of simple and/or higher order functions that can be combined with NodeJS `stream` and `child processes` to create recipes for analytics driven business solutions. | ||
Classify text, analyse sentiments, recognize user intents for chatbot using **`wink-naive-bayes-text-classifier`**. It is a part of [wink](https://www.npmjs.com/~sanjaya) — a growing family of high quality packages for Statistical Analysis, Natural Language Processing and Machine Learning in NodeJS. | ||
Easily classify text, analyse sentiments, recognize intents using **wink-naive-bayes-text-classifier**. It's [API](#api) offers a rich set of features: | ||
It's [API](#api) offers a rich set of features: | ||
@@ -104,4 +104,4 @@ 1. Configure text preparation task such as **amplify negation**, **tokenize**, **stem**, **remove stop words**, and **propagate negation** using [wink-nlp-utils](https://www.npmjs.com/package/wink-nlp-utils) or any other package of your choice. | ||
[ | ||
[ 'prepay', 12.052329801050742 ], | ||
[ 'autoloan', -0.5258305619141836 ] | ||
[ 'prepay', 12.052329801050746 ], | ||
[ 'autoloan', -0.5258305619141872 ] | ||
] | ||
@@ -108,0 +108,0 @@ ``` |
@@ -112,6 +112,6 @@ // wink-naive-bayes-text-classifier | ||
( config.smoothingFactor > 0 ) ? | ||
Math.log2( ( ( count[ label ][ w ] || 0 ) + config.smoothingFactor ) / | ||
( words[ label ] + ( voc.size * config.smoothingFactor ) ) ) : | ||
voc.has( w ) ? Math.log2( ( ( count[ label ][ w ] || 0 ) + 1 ) / | ||
( words[ label ] + voc.size ) ) : | ||
( Math.log2( ( ( count[ label ][ w ] || 0 ) + config.smoothingFactor ) ) - | ||
Math.log2( words[ label ] + ( voc.size * config.smoothingFactor ) ) ) : | ||
voc.has( w ) ? ( Math.log2( ( ( count[ label ][ w ] || 0 ) + 1 ) ) - | ||
Math.log2( ( words[ label ] + voc.size ) ) ) : | ||
0 | ||
@@ -142,4 +142,5 @@ ); | ||
// so to avoid recomputation. See comments in `logLikelihood()`. | ||
return ( Math.log2( ( clw + ( config.smoothingFactor || 1 ) ) / | ||
( wl + ( voc.size * ( config.smoothingFactor || 1 ) ) ) ) ); | ||
return ( Math.log2( ( clw + ( config.smoothingFactor || 1 ) ) ) - | ||
Math.log2( ( wl + ( voc.size * ( config.smoothingFactor || 1 ) ) ) ) | ||
); | ||
@@ -181,4 +182,4 @@ }; // inverseLogLikelihood() | ||
// Add prior probabilities as `lh` (and therefore `ilh`) is **0**. | ||
lh += Math.log2( samplesInLabel / sum ); | ||
ilh += Math.log2( samplesNotInLabel / sum ); | ||
lh += ( Math.log2( samplesInLabel ) - Math.log2( sum ) ); | ||
ilh += ( Math.log2( samplesNotInLabel ) - Math.log2( sum ) ); | ||
} | ||
@@ -185,0 +186,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
498
61458