gov.sandia.cognition.learning.function.scalar

## Class PolynomialFunction

• ### Nested Class Summary

Nested Classes
Modifier and Type Class and Description
`static interface ` `PolynomialFunction.ClosedForm`
Describes functionality of a closed-form algebraic polynomial function
`static class ` `PolynomialFunction.Cubic`
Algebraic treatment for a polynomial of the form y(x) = q0 + q1*x + q2*x^2 + q3*x^3
`static class ` `PolynomialFunction.Linear`
Utilities for algebraic treatment of a linear polynomial of the form y(x) = q0 + q1*x
`static class ` `PolynomialFunction.Quadratic`
Utilities for algebraic treatment of a quadratic polynomial of the form y(x) = q0 + q1*x + q2*x^2.
`static class ` `PolynomialFunction.Regression`
Performs Linear Regression using an arbitrary set of PolynomialFunction basis functions
• ### Constructor Summary

Constructors
Constructor and Description
`PolynomialFunction(double exponent)`
Creates a new instance of PolynomialFunction
`PolynomialFunction(PolynomialFunction other)`
Copy Constructor
• ### Method Summary

All Methods
Modifier and Type Method and Description
`PolynomialFunction` `clone()`
This makes public the clone method on the `Object` class and removes the exception that it throws.
`Vector` `computeParameterGradient(java.lang.Double input)`
Computes the derivative of the output with respect to the parameters for a particular input.
`void` `convertFromVector(Vector parameters)`
Sets the value of the exponent
`Vector` `convertToVector()`
Returns the value of the exponent
`static java.util.ArrayList<PolynomialFunction>` `createPolynomials(double... polynomialExponents)`
Creates an array of PolynomialFunctions from the array of their exponents
`double` `differentiate(double input)`
Differentiates the output of the function about the given input
`double` `evaluate(double input)`
Evaluates the polynomial for the given input, returning Math.pow( input, exponent )
`double` `getExponent()`
Getter for exponent
`void` `setExponent(double exponent)`
Setter for exponent
`java.lang.String` `toString()`
• ### Methods inherited from class java.lang.Object

`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`
• ### Methods inherited from interface gov.sandia.cognition.evaluator.Evaluator

`evaluate`
• ### Methods inherited from interface gov.sandia.cognition.math.DifferentiableUnivariateScalarFunction

`differentiate`
• ### Methods inherited from interface gov.sandia.cognition.math.UnivariateScalarFunction

`evaluate, evaluateAsDouble`
• ### Constructor Detail

• #### PolynomialFunction

`public PolynomialFunction(double exponent)`
Creates a new instance of PolynomialFunction
Parameters:
`exponent` - Real-valued exponent of this polynomial
• #### PolynomialFunction

`public PolynomialFunction(PolynomialFunction other)`
Copy Constructor
Parameters:
`other` - PolynomialFunction to copy
• ### Method Detail

• #### clone

`public PolynomialFunction clone()`
Description copied from class: `AbstractCloneableSerializable`
This makes public the clone method on the `Object` class and removes the exception that it throws. Its default behavior is to automatically create a clone of the exact type of object that the clone is called on and to copy all primitives but to keep all references, which means it is a shallow copy. Extensions of this class may want to override this method (but call `super.clone()` to implement a "smart copy". That is, to target the most common use case for creating a copy of the object. Because of the default behavior being a shallow copy, extending classes only need to handle fields that need to have a deeper copy (or those that need to be reset). Some of the methods in `ObjectUtil` may be helpful in implementing a custom clone method. Note: The contract of this method is that you must use `super.clone()` as the basis for your implementation.
Specified by:
`clone` in interface `Vectorizable`
Specified by:
`clone` in interface `CloneableSerializable`
Overrides:
`clone` in class `AbstractCloneableSerializable`
Returns:
A clone of this object.
• #### convertToVector

`public Vector convertToVector()`
Returns the value of the exponent
Specified by:
`convertToVector` in interface `Vectorizable`
Returns:
Exponent of this polynomial
• #### convertFromVector

`public void convertFromVector(Vector parameters)`
Sets the value of the exponent
Specified by:
`convertFromVector` in interface `Vectorizable`
Parameters:
`parameters` - Exponent of this polynomial
• #### differentiate

`public double differentiate(double input)`
Description copied from interface: `DifferentiableUnivariateScalarFunction`
Differentiates the output of the function about the given input
Specified by:
`differentiate` in interface `DifferentiableUnivariateScalarFunction`
Parameters:
`input` - Input about which to compute the derivative of the function output
Returns:
Derivative of the output with respect to the input
• #### evaluate

`public double evaluate(double input)`
Evaluates the polynomial for the given input, returning Math.pow( input, exponent )
Specified by:
`evaluate` in interface `UnivariateScalarFunction`
Parameters:
`input` - Input about which to compute the polynomial
Returns:
Math.pow(input,exponent)

`public Vector computeParameterGradient(java.lang.Double input)`
Description copied from interface: `ParameterGradientEvaluator`
Computes the derivative of the output with respect to the parameters for a particular input.
Specified by:
`computeParameterGradient` in interface `ParameterGradientEvaluator<java.lang.Double,java.lang.Double,Vector>`
Parameters:
`input` - Input about which to compute the parameter gradient.
Returns:
Change of the parameters with respect to the output.
• #### toString

`public java.lang.String toString()`
Overrides:
`toString` in class `java.lang.Object`
• #### getExponent

`public double getExponent()`
Getter for exponent
Returns:
Real-valued exponent of this polynomial
• #### setExponent

`public void setExponent(double exponent)`
Setter for exponent
Parameters:
`exponent` - Real-valued exponent of this polynomial
• #### createPolynomials

`public static java.util.ArrayList<PolynomialFunction> createPolynomials(double... polynomialExponents)`
Creates an array of PolynomialFunctions from the array of their exponents
Parameters:
`polynomialExponents` - Exponents for the various polynomials
Returns:
Array of PolynomialFunctions from the given exponents