Naive Bayes
Explore Gaussian, Multinomial, Complement, Bernoulli, and Categorical Naive Bayes in JavaScript and TypeScript with @kanaries/ml.
Module overview
The Bayes module in @kanaries/ml focuses on lightweight probabilistic classifiers for numeric, count, binary, and categorical inputs. These models are often useful as fast baselines because they train quickly, infer quickly, and are easy to reason about when you want probability-oriented outputs.
This module is a strong fit when:
- features are continuous values, counts, binary indicators, or categorical IDs
- you want a simple model before moving to linear, tree, or ensemble methods
- low-latency inference matters in browser or Node.js applications
JavaScript implementation
@kanaries/ml brings naive Bayes estimators into JavaScript and TypeScript so teams can keep feature encoding, prediction logic, and application code in the same runtime. This is especially useful for frontend-heavy workflows, text or flag-based classification, and product logic that benefits from lightweight probability estimates.
If someone searches for "naive Bayes in JavaScript" or "CategoricalNB in TypeScript", this module page should make it clear that @kanaries/ml provides JS-native implementations with a familiar estimator workflow.
Quick navigation
- GaussianNB: best for continuous numeric features
- MultinomialNB: best for non-negative count features
- ComplementNB: count-feature classifier that can help with imbalanced classes
- BernoulliNB: best for boolean or presence/absence features
- CategoricalNB: best for integer-encoded categorical inputs
Detailed module guide
How to choose an algorithm
- Use GaussianNB when features are continuous numeric measurements.
- Use MultinomialNB or ComplementNB when features are non-negative counts.
- Use BernoulliNB when features represent yes/no states, token presence, clicks, or flags.
- Use CategoricalNB when each feature is a discrete category.
JavaScript deployment notes
- Keep feature encoding rules stable between training and inference.
- These models are especially attractive in JS applications because they are easy to run close to product logic.
- Start here when you need a fast probabilistic baseline and low operational complexity.
Linear SVR
Learn what Linear SVR does, when to use it, and how to run LinearSVR in JavaScript or TypeScript with @kanaries/ml for browser and Node.js applications.
GaussianNB
Classify continuous numeric features with the GaussianNB JavaScript and TypeScript implementation in @kanaries/ml for browser and Node.js applications.