MachineLearning/logistic_regression library

🔢 Logistic Regression (binary, gradient descent)

A small, production-aware implementation of binary logistic regression trained with batch gradient descent. Supports multiple continuous features and an intercept term. Returns learned weights where the first weight is the intercept.

Contract:

  • Input: feature matrix X (n x m) and labels y with values {0,1}.
  • Output: List

Time Complexity: O(epochs * n * m) Space Complexity: O(m)

Classes

LogisticRegressionModel
Thin adapter providing a fit/predict interface for logistic regression.

Functions

logisticRegressionFit(List<List<double>> X, List<int> y, {double lr = 0.1, int epochs = 500}) → List<double>
logisticRegressionPredictClass(List<double> weights, List<double> features, {double threshold = 0.5}) → int