Poisson, Gamma, and Tweedie Regression
Model counts and positive skewed targets with PoissonRegressor, GammaRegressor, and TweedieRegressor in browser or Node.js.
View as MarkdownGeneralized linear models
Algorithm overview
Generalized linear models connect a linear predictor to non-Gaussian targets. Poisson regression is suited to counts, Gamma regression to positive continuous values, and Tweedie regression spans several variance relationships through its power parameter.
JavaScript implementation
The @kanaries/ml implementations use regularized Newton updates and a guarded line search, with log links for positive-mean families.
Interactive generalized linear model playground
Switch between Poisson, Gamma, and Tweedie regression, tune regularization, and add positive-valued observations. The prediction is refitted live with the chosen Linear estimator.
Poisson playground
Adjust the data and model, then click the chart to add a training observation.
Quick start
import { Linear } from '@kanaries/ml';
const model = new Linear.PoissonRegressor({ alpha: 0.1 });
model.fit([[0], [1], [2]], [1, 2, 4]);
console.log(model.predict([[3]]));Detailed API reference
All three accept alpha, fitIntercept, maxIter, and tol. Poisson and Gamma regression use their canonical log link. TweedieRegressor additionally accepts power (values in (0, 1) are undefined) and link: 'auto' | 'identity' | 'log'. Fitted models expose coef, intercept, and nIter.
Bayesian Ridge and ARD Regression
Run BayesianRidge and sparse ARDRegression in JavaScript or TypeScript with posterior uncertainty and sklearn-style APIs.
Tree Models
Explore decision trees and extra trees in JavaScript and TypeScript with @kanaries/ml for interpretable tabular classification and regression.