bayesian-network

1.0.2 • Public • Published

Bayesian Network

A simple Bayesian network based on Baye's rule and the conditional independence assumption.

Example Usage

const classifier = new BayesianNetwork();
 
classifier.addDocument("hello you are amazing", "positive");
classifier.addDocument("today is a beautiful day", "positive");
classifier.addDocument("its dark out today", "negative");
classifier.addDocument("today was bad", "negative");
 
classifier.calculateLogFrequencies();
 
console.log(classifier.classify('hello you are great'));
 
/*
{
  classification: { label: 'POSITIVE', value: -6.238324625039508 },
  labels: { POSITIVE: -6.238324625039508, NEGATIVE: -6.238324625039508 }
}
*/

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    4
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    4
  • 1.0.1
    1
  • 1.0.0
    0

Package Sidebar

Install

npm i bayesian-network

Weekly Downloads

5

Version

1.0.2

License

ISC

Unpacked Size

12 MB

Total Files

8

Last publish

Collaborators

  • jakecyr