gov.sandia.cognition.learning.function.scalar
Class IdentityScalarFunction

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.math.AbstractScalarFunction<Double>
          extended by gov.sandia.cognition.math.AbstractUnivariateScalarFunction
              extended by gov.sandia.cognition.math.AbstractDifferentiableUnivariateScalarFunction
                  extended by gov.sandia.cognition.learning.function.scalar.IdentityScalarFunction
All Implemented Interfaces:
Evaluator<Double,Double>, DifferentiableEvaluator<Double,Double,Double>, DifferentiableUnivariateScalarFunction, ScalarFunction<Double>, UnivariateScalarFunction, CloneableSerializable, Serializable, Cloneable

public class IdentityScalarFunction
extends AbstractDifferentiableUnivariateScalarFunction

A univariate scalar identity function: f(x) = x. This function simply acts as a pass-through, where evaluate(input) == input for any input. The derivative is always equal to 1.0. This is for those classes that expect an evaluator, but you don't want to alter the value of the function, like a FeedforwardNeuralNetwork. Note: prior to 3.3.0, this class was named "LinearFunction". Using LinearFunction with default values will produce the same result. However, it how has additional parameters.

Since:
3.3.3
Author:
Kevin R. Dixon
See Also:
Serialized Form

Constructor Summary
IdentityScalarFunction()
          Creates a new LinearFunction.
 
Method Summary
 IdentityScalarFunction clone()
          This makes public the clone method on the Object class and removes the exception that it throws.
 double differentiate(double input)
          Differentiates the output of the function about the given input
 double evaluate(double input)
          Produces a double output for the given double input
 Double evaluate(Double input)
          Returns the result of calling evaluateAsDouble.
 double evaluateAsDouble(Double input)
          Evaluates the scalar function as a double.
 
Methods inherited from class gov.sandia.cognition.math.AbstractDifferentiableUnivariateScalarFunction
differentiate
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IdentityScalarFunction

public IdentityScalarFunction()
Creates a new LinearFunction.

Method Detail

clone

public IdentityScalarFunction 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 CloneableSerializable
Overrides:
clone in class AbstractCloneableSerializable
Returns:
A clone of this object.

evaluate

public Double evaluate(Double input)
Description copied from class: AbstractScalarFunction
Returns the result of calling evaluateAsDouble.

Specified by:
evaluate in interface Evaluator<Double,Double>
Overrides:
evaluate in class AbstractUnivariateScalarFunction
Parameters:
input - The input value.
Returns:
The result evaluated as a double.

evaluate

public double evaluate(double input)
Description copied from interface: UnivariateScalarFunction
Produces a double output for the given double input

Parameters:
input - Input to the Evaluator
Returns:
output at the given input

evaluateAsDouble

public double evaluateAsDouble(Double input)
Description copied from interface: ScalarFunction
Evaluates the scalar function as a double.

Specified by:
evaluateAsDouble in interface ScalarFunction<Double>
Overrides:
evaluateAsDouble in class AbstractUnivariateScalarFunction
Parameters:
input - The input value.
Returns:
The scalar output calculated from the given input.

differentiate

public double differentiate(double input)
Description copied from interface: DifferentiableUnivariateScalarFunction
Differentiates the output of the function about the given input

Parameters:
input - Input about which to compute the derivative of the function output
Returns:
Derivative of the output with respect to the input