Class LogisticRegression

java.lang.Object
org.episteme.core.mathematics.ml.LogisticRegression

public class LogisticRegression extends Object
Logistic Regression - binary classification using sigmoid function.

Model: P(y=1|x) = 1/(1 + e^(-w·x)) Training: Gradient descent on log-likelihood Applications: Classification, probability estimation

Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Constructor Details

    • LogisticRegression

      public LogisticRegression()
  • Method Details

    • fit

      public void fit(Real[][] X, Real[] y)
      Trains logistic regression model.
      Parameters:
      X - training data (n samples × d features)
      y - binary labels (0 or 1)
    • predictProba

      public Real predictProba(Real[] x)
      Predicts probability P(y=1|x).
    • predict

      public Real predict(Real[] x)
      Predicts class (0 or 1) using threshold 0.5.
    • score

      public Real score(Real[][] X, Real[] y)
      Computes accuracy on test set.
    • fitWithRegularization

      public void fitWithRegularization(Real[][] X, Real[] y, Real lambda)
      L2 regularization (Ridge): adds λ||w||² to loss.
    • setLearningRate

      public void setLearningRate(Real lr)
    • setMaxIterations

      public void setMaxIterations(int iter)
    • getWeights

      public Real[] getWeights()
    • getBias

      public Real getBias()