Class SimpleLinearRegression

  • All Implemented Interfaces:
    Regression

    public class SimpleLinearRegression
    extends java.lang.Object
    implements Regression
    • Constructor Summary

      Constructors 
      Constructor Description
      SimpleLinearRegression​(com.kylecorry.geometry.Point... points)
      Create a simple linear regression from the given points.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double getFitStrength()
      Gets the strength of the fit from [0, 1] (r^2), where 1 is a perfect fit and 0 is no fit.
      double predict​(double input1, double... input)
      Predict the value at the given input.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SimpleLinearRegression

        public SimpleLinearRegression​(com.kylecorry.geometry.Point... points)
        Create a simple linear regression from the given points.
        Parameters:
        points - The points to fit the regression to.
    • Method Detail

      • predict

        public double predict​(double input1,
                              double... input)
        Predict the value at the given input.
        Specified by:
        predict in interface Regression
        Parameters:
        input1 - The first input.
        input - Not used in SLR.
        Returns:
        The prediction at input1.
      • getFitStrength

        public double getFitStrength()
        Gets the strength of the fit from [0, 1] (r^2), where 1 is a perfect fit and 0 is no fit.
        Returns:
        The strength of the fit.