Class LinearRegression

java.lang.Object
ai.beestream.jitnn.ml.LinearRegression

public final class LinearRegression extends Object
Least squares with an optional L2 penalty alpha (ridge regression), solved in closed form from the normal equations (X^T X + alpha I) w = X^T y on centred data, after scikit-learn's LinearRegression (alpha 0) and Ridge.
  • Constructor Details

    • LinearRegression

      public LinearRegression(float alpha, boolean fitIntercept)
      Ridge regression with penalty alpha (0 for plain least squares), with or without an intercept.
    • LinearRegression

      public LinearRegression()
      Least squares with an intercept.
  • Method Details

    • fit

      public LinearRegression fit(Tensor x, Tensor y)
      y [n] or [n, t].
    • coef

      public Tensor coef()
      Coefficients [d] (one target) or [t, d].
    • intercept

      public Tensor intercept()
      The fitted intercept (zero without one).
    • predict

      public Tensor predict(Tensor x)
      Predictions x w + b for samples x [n, features].