Package ai.kognition.pilecv4j.nr
Class LinearRegressionWithKnownSlope
- java.lang.Object
-
- ai.kognition.pilecv4j.nr.LinearRegressionWithKnownSlope
-
- All Implemented Interfaces:
Minimizer.Func
public class LinearRegressionWithKnownSlope extends Object implements 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.
-
-
Constructor Summary
Constructors Constructor Description LinearRegressionWithKnownSlope(double slope, double[] x, double[] y)
-
-
-
Method Detail
-
func
public double func(double[] m)
- Specified by:
funcin interfaceMinimizer.Func
-
-