public class UnivariateEstimator extends Function
[x1, x2,
... xn]
then an estimator is set up based on the
function values using a polynomial of user-specified degree.
Suppose that the desired polynomial degree is 2 so that the
polynomial is a quadratic. Then a series of 3 coefficients
a0, a1, a2
are
calculated using the values, and the estimator will approximate
function values using the coefficients as f(x) =
a0 + a1x + a2x2
.Constructor and Description |
---|
UnivariateEstimator(double[] x,
double[] f,
int degree)
Constructs a univariate estimator using the specified function values
and polynomial degree.
|
UnivariateEstimator(java.lang.Object obj)
Constructs an estimator from the specified encoding.
|
Modifier and Type | Method and Description |
---|---|
double |
evaluate(double[] variables)
Evalutes a function value with the specified inputs.
|
java.lang.Object |
getEncoding()
Gets an encoded representation of this estimator.
|
void |
useEncoding(java.lang.Object obj)
Uses an encoded representation of this estimator to recreate the
estimator contents.
|
public UnivariateEstimator(double[] x, double[] f, int degree)
x
- the array of x values.f
- the function values at x
points.degree
- the desired polynomial degree.public UnivariateEstimator(java.lang.Object obj)
getEncoding
.obj
- the object encoding.getEncoding()
public double evaluate(double[] variables)
Function
public java.lang.Object getEncoding()
getEncoding
in interface Encodable
getEncoding
in class Function
double[]
array of coefficients.useEncoding(java.lang.Object)
public void useEncoding(java.lang.Object obj)
useEncoding
in interface Encodable
useEncoding
in class Function
obj
- the object encoding.getEncoding()