Skip to main content
Module

x/simplestatistics/index.js>bayesian

simple statistics for node & browser javascript
Go to Latest
class bayesian
import { bayesian } from "https://deno.land/x/simplestatistics@v7.7.5/index.js";

Bayesian Classifier

This is a naïve bayesian classifier that takes singly-nested objects.

Examples

var bayes = new BayesianClassifier(); bayes.train({ species: 'Cat' }, 'animal'); var result = bayes.score({ species: 'Cat' }) // result // { // animal: 1 // }

Constructors

new
bayesian()

Methods

score(item)

Generate a score of how well this item matches all possible categories based on its attributes

train(item, category)

Train the classifier with a new item, which has a single dimension of Javascript literal keys and values.