Package ai.kognition.pilecv4j.nr
Class SimpleLinearRegression
java.lang.Object
ai.kognition.pilecv4j.nr.SimpleLinearRegression
- All Implemented Interfaces:
Minimizer.Func
This class will do a linear regression by minimizing the squared error between the points provided to the constructor and the line specified by y = m[0]x + m[1]
NOTE: The error term is calculated using the vertical distance. That is it minimizes the error in the 'y' term only. This is more robust for determining the slope/intercept form of a line because the starting point cannot be rotated through the Y axis. In other words, if the slope of the points is approximately -3.0 and the slope of the starting iteration is 3.0, then RAISING the slope lowers the perpendicular distance. This moves the iterations in the wrong direction.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
y
public final double[] y -
x
public final double[] x
-
-
Constructor Details
-
SimpleLinearRegression
public SimpleLinearRegression(double[] x, double[] y)
-
-
Method Details
-
func
public double func(double[] lineDefMb) - Specified by:
funcin interfaceMinimizer.Func
-