@kanaries/ml
API Reference/Ensemble

Ensemble Learning

Explore ensemble learning algorithms in JavaScript and TypeScript with @kanaries/ml, including Isolation Forest, AdaBoost, random forests, and bagging models.

Module overview

The Ensemble module combines multiple weak learners to create stronger models for anomaly detection, classification, and regression. These algorithms are useful when single-model baselines are close to useful but need more robustness or more expressive decision behavior.

This module is a strong fit when:

  • you need anomaly detection on tabular product or telemetry data
  • a simple classifier or regressor underfits important patterns
  • you want stronger performance without moving all the way to heavier model families

JavaScript implementation

@kanaries/ml provides ensemble models in JavaScript and TypeScript so teams can run boosted learners and anomaly detection inside browser products and Node.js services. This is particularly helpful when feature generation, threshold logic, and downstream product actions already live in JS and should stay close to the model runtime.

If someone searches for "Isolation Forest in JavaScript" or "AdaBoost in TypeScript", this module is the right entry point.

Quick navigation

Detailed module guide

How to choose an algorithm

  1. Use Isolation Forest when labels are unavailable and the main goal is outlier detection.
  2. Use RandomForestClassifier or RandomForestRegressor when tree variance is high and nonlinear patterns matter.
  3. Use BaggingClassifier when you want bootstrap aggregation around decision trees or a custom classifier.
  4. Use AdaBoost Classifier when a simple classifier misses hard examples.
  5. Use AdaBoost Regressor when a single regressor is too weak for the target pattern.
  6. Use GradientBoostingClassifier or GradientBoostingRegressor when you want stage-wise boosting with fine control over shrinkage and depth.
  7. Use XGBoostClassifier or XGBoostRegressor when you want regularized, exact-greedy boosting close to the xgboost library.

JavaScript deployment notes

  • Treat thresholds, estimator counts, and learning rates as product-level tuning decisions.
  • Ensemble models often provide a good middle ground between simple baselines and more operationally complex systems.
  • In JS applications, keep feature extraction and prediction close together so model output can flow directly into business logic.