gov.sandia.cognition.learning.function.vector
Class MultivariateDiscriminantWithBias

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.learning.function.vector.MultivariateDiscriminant
          extended by gov.sandia.cognition.learning.function.vector.MultivariateDiscriminantWithBias
All Implemented Interfaces:
Evaluator<Vector,Vector>, GradientDescendable, ParameterGradientEvaluator<Vector,Matrix>, DifferentiableEvaluator<Vector,Vector,Matrix>, DifferentiableVectorFunction, VectorFunction, VectorInputEvaluator<Vector,Vector>, Vectorizable, VectorizableDifferentiableVectorFunction, VectorizableVectorFunction, VectorOutputEvaluator<Vector,Vector>, CloneableSerializable, Serializable, Cloneable

public class MultivariateDiscriminantWithBias
extends MultivariateDiscriminant

A multivariate discriminant (matrix multiply) plus a constant vector that gets added to the output of the discriminant.

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

Field Summary
protected  Vector bias
          Bias term that gets added the output of the matrix multiplication.
 
Constructor Summary
MultivariateDiscriminantWithBias()
          Default constructor.
MultivariateDiscriminantWithBias(int numInputs, int numOutputs)
          Creates a new MultivariateDiscriminantWithBias
MultivariateDiscriminantWithBias(Matrix discriminant)
          Creates a new instance of MultivariateDiscriminantWithBias.
MultivariateDiscriminantWithBias(Matrix discriminant, Vector bias)
          Creates a new instance of MultivariateDiscriminantWithBias.
 
Method Summary
 MultivariateDiscriminantWithBias clone()
          This makes public the clone method on the Object class and removes the exception that it throws.
 Matrix computeParameterGradient(Vector input)
          Computes the derivative of the function about the input with respect to the parameters of the function
 void convertFromVector(Vector parameters)
          Uploads a matrix from a row-stacked vector of parameters.
 Vector convertToVector()
          Creates a row-stacked version of the discriminant.
 Vector evaluate(Vector input)
          Evaluates the function on the given input and returns the output.
 Vector getBias()
          Getter for bias
 void setBias(Vector bias)
          Setter for bias
 
Methods inherited from class gov.sandia.cognition.learning.function.vector.MultivariateDiscriminant
computeParameterGradient, differentiate, getDiscriminant, getInputDimensionality, getOutputDimensionality, setDiscriminant, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

bias

protected Vector bias
Bias term that gets added the output of the matrix multiplication.

Constructor Detail

MultivariateDiscriminantWithBias

public MultivariateDiscriminantWithBias()
Default constructor.


MultivariateDiscriminantWithBias

public MultivariateDiscriminantWithBias(int numInputs,
                                        int numOutputs)
Creates a new MultivariateDiscriminantWithBias

Parameters:
numInputs - Number of inputs of the function (number of matrix columns)
numOutputs - Number of outputs of the function (number of matrix rows)

MultivariateDiscriminantWithBias

public MultivariateDiscriminantWithBias(Matrix discriminant)
Creates a new instance of MultivariateDiscriminantWithBias.

Parameters:
discriminant - internal matrix to premultiply input vectors by.

MultivariateDiscriminantWithBias

public MultivariateDiscriminantWithBias(Matrix discriminant,
                                        Vector bias)
Creates a new instance of MultivariateDiscriminantWithBias.

Parameters:
discriminant - internal matrix to premultiply input vectors by.
bias - Bias term that gets added the output of the matrix multiplication.
Method Detail

clone

public MultivariateDiscriminantWithBias 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 GradientDescendable
Specified by:
clone in interface Vectorizable
Specified by:
clone in interface VectorizableVectorFunction
Specified by:
clone in interface CloneableSerializable
Overrides:
clone in class MultivariateDiscriminant
Returns:
A clone of this object.

evaluate

public Vector evaluate(Vector input)
Description copied from interface: Evaluator
Evaluates the function on the given input and returns the output.

Specified by:
evaluate in interface Evaluator<Vector,Vector>
Overrides:
evaluate in class MultivariateDiscriminant
Parameters:
input - The input to evaluate.
Returns:
The output produced by evaluating the input.

getBias

public Vector getBias()
Getter for bias

Returns:
Bias term that gets added the output of the matrix multiplication.

setBias

public void setBias(Vector bias)
Setter for bias

Parameters:
bias - Bias term that gets added the output of the matrix multiplication.

convertToVector

public Vector convertToVector()
Description copied from class: MultivariateDiscriminant
Creates a row-stacked version of the discriminant.

Specified by:
convertToVector in interface Vectorizable
Overrides:
convertToVector in class MultivariateDiscriminant
Returns:
row-stacked Vector representing the discriminant

convertFromVector

public void convertFromVector(Vector parameters)
Description copied from class: MultivariateDiscriminant
Uploads a matrix from a row-stacked vector of parameters.

Specified by:
convertFromVector in interface Vectorizable
Overrides:
convertFromVector in class MultivariateDiscriminant
Parameters:
parameters - row-stacked version of discriminant

computeParameterGradient

public Matrix computeParameterGradient(Vector input)
Description copied from interface: GradientDescendable
Computes the derivative of the function about the input with respect to the parameters of the function

Specified by:
computeParameterGradient in interface GradientDescendable
Specified by:
computeParameterGradient in interface ParameterGradientEvaluator<Vector,Matrix>
Overrides:
computeParameterGradient in class MultivariateDiscriminant
Parameters:
input - Point about which to differentiate w.r.t. the parameters
Returns:
Matrix of parameter gradients