public class SimpleLinearRegressor
extends java.lang.Object
Constructor and Description |
---|
SimpleLinearRegressor() |
SimpleLinearRegressor(double[] xValues,
double[] yValues) |
Modifier and Type | Method and Description |
---|---|
void |
addObservation(double x,
double y)
Adds an observation to the regression data
|
void |
clearObservations()
Clears all existing regression data
|
UnivariatePolynomialFunction |
regress()
Performs the regression, producing a function representing the
least-squares linear approximation of the data.
|
static UnivariatePolynomialFunction |
regress(double[] xValues,
double[] yValues)
Performs regression on the provided data, producing a function
representing the least-squares linear approximation of the data.
|
java.lang.String |
toString() |
public SimpleLinearRegressor()
public SimpleLinearRegressor(double[] xValues, double[] yValues)
xValues
- the initial x value observationsyValues
- the initial y value observationspublic static UnivariatePolynomialFunction regress(double[] xValues, double[] yValues)
xValues
- the data's x-valuesyValues
- the data's y-valuespublic void addObservation(double x, double y)
x
- the observed x valuey
- the observed y valuepublic void clearObservations()
public UnivariatePolynomialFunction regress()
public java.lang.String toString()
toString
in class java.lang.Object