https://github.com/jakecyr/bayesian-network
Naive Bayes Classifier built in Node.js
https://github.com/jakecyr/bayesian-network
bayesian-network bayesian-networks classifier machine-learning nodejs
Last synced: 4 months ago
JSON representation
Naive Bayes Classifier built in Node.js
- Host: GitHub
- URL: https://github.com/jakecyr/bayesian-network
- Owner: jakecyr
- Created: 2017-04-27T02:50:15.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-27T18:19:51.000Z (over 2 years ago)
- Last Synced: 2025-02-18T04:37:28.505Z (5 months ago)
- Topics: bayesian-network, bayesian-networks, classifier, machine-learning, nodejs
- Language: JavaScript
- Homepage:
- Size: 4.61 MB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bayesian Network
A simple Bayesian network based on Baye's rule and the conditional independence assumption.
## Example Usage
```javascript
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 }
}
*/
```