项目作者: jakecyr

项目描述 :
Naive Bayes Classifier built in Node.js
高级语言: JavaScript
项目地址: git://github.com/jakecyr/bayesian-network.git
创建时间: 2017-04-27T02:50:15Z
项目社区:https://github.com/jakecyr/bayesian-network

开源协议:

下载


Bayesian Network

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

Example Usage

  1. const classifier = new BayesianNetwork();
  2. classifier.addDocument("hello you are amazing", "positive");
  3. classifier.addDocument("today is a beautiful day", "positive");
  4. classifier.addDocument("its dark out today", "negative");
  5. classifier.addDocument("today was bad", "negative");
  6. classifier.calculateLogFrequencies();
  7. console.log(classifier.classify('hello you are great'));
  8. /*
  9. {
  10. classification: { label: 'POSITIVE', value: -6.238324625039508 },
  11. labels: { POSITIVE: -6.238324625039508, NEGATIVE: -6.238324625039508 }
  12. }
  13. */