Class PolynomialRegression

java.lang.Object
org.episteme.core.mathematics.statistics.fitting.PolynomialRegression

public class PolynomialRegression extends Object
Polynomial regression: y = a₀ + a₁x + a₂x² + ... + aₙxⁿ.

Uses normal equations with LU decomposition for stability.

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

    • fit

      public static PolynomialRegression fit(double[] x, double[] y, int degree)
      Fits a polynomial of given degree to the data.
      Parameters:
      x - Independent variable values
      y - Dependent variable values
      degree - Polynomial degree (1 = linear, 2 = quadratic, etc.)
      Returns:
      PolynomialRegression model
    • predict

      public double predict(double x)
      Predicts y for given x.
    • predict

      public Real predict(Real x)
    • getCoefficients

      public double[] getCoefficients()
    • getDegree

      public int getDegree()
    • getRSquared

      public double getRSquared()
    • toString

      public String toString()
      Overrides:
      toString in class Object