Class SimpleLinearRegression
- java.lang.Object
-
- com.thegongoliers.math.regression.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.
-
-
-
Method Detail
-
predict
public double predict(double input1, double... input)
Predict the value at the given input.- Specified by:
predict
in interfaceRegression
- 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.
-
-