https://github.com/catplvsplus/naive-bayes
https://github.com/catplvsplus/naive-bayes
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/catplvsplus/naive-bayes
- Owner: catplvsplus
- License: mit
- Created: 2023-07-26T14:59:13.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-26T15:04:50.000Z (almost 3 years ago)
- Last Synced: 2025-01-18T01:07:38.216Z (over 1 year ago)
- Language: TypeScript
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# naive-bayes
```js
import { NaiveBayesClassifier } from '@catplusplus/naive-bayes';
const classifier = new NaiveBayesClassifier();
await classifier.addDocument('Hello, good morning!', 'greetings');
await classifier.addDocument('Hello, good evening!', 'greetings');
await classifier.addDocument('Hello, good day!', 'greetings');
await classifier.addDocument('How are you today?', 'question');
await classifier.addDocument('What are you up to?', 'question');
await classifier.addDocument('What is your name?', 'question');
await classifier.classify('Hi, good afternoon!'); // categories: [greetings, question]
await classifier.classify('Who are you?'); // categories: [question, greetings]
```