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

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

public class DifferentiableGeneralizedLinearModel
extends GeneralizedLinearModel
implements GradientDescendable, DifferentiableVectorFunction

A GradientDescenable version of a GeneralizedLinearModel, in other words, a GeneralizedLinearModel where the squashing function is differentiable

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

Constructor Summary
DifferentiableGeneralizedLinearModel()
          Default Constructor.
DifferentiableGeneralizedLinearModel(DifferentiableGeneralizedLinearModel other)
          Creates a new instance of DifferentiableGeneralizedLinearModel
DifferentiableGeneralizedLinearModel(int numInputs, int numOutputs, DifferentiableUnivariateScalarFunction scalarFunction)
          Creates a new instance of GeneralizedLinearModel
DifferentiableGeneralizedLinearModel(MultivariateDiscriminant matrixMultiply, DifferentiableUnivariateScalarFunction scalarSquashingFunction)
          Creates a new instance of DifferentiableGeneralizedLinearModel
DifferentiableGeneralizedLinearModel(MultivariateDiscriminant matrixMultiply, DifferentiableVectorFunction squashingFunction)
          Creates a new instance of DifferentiableGeneralizedLinearModel
 
Method Summary
 DifferentiableGeneralizedLinearModel 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
 Matrix differentiate(Vector input)
          Differentiate the VectorFunction at input and return the Jacobian
 DifferentiableVectorFunction getSquashingFunction()
          Getter for squashingFunction
 
Methods inherited from class gov.sandia.cognition.learning.function.vector.GeneralizedLinearModel
convertFromVector, convertToVector, evaluate, getDiscriminant, getInputDimensionality, getOutputDimensionality, setDiscriminant, setSquashingFunction, 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.matrix.Vectorizable
convertFromVector, convertToVector
 

Constructor Detail

DifferentiableGeneralizedLinearModel

public DifferentiableGeneralizedLinearModel()
Default Constructor. Creates a 1x1 model with a identity function for the output.


DifferentiableGeneralizedLinearModel

public DifferentiableGeneralizedLinearModel(int numInputs,
                                            int numOutputs,
                                            DifferentiableUnivariateScalarFunction scalarFunction)
Creates a new instance of GeneralizedLinearModel

Parameters:
numInputs - Number of inputs of the function (number of matrix columns)
numOutputs - Number of outputs of the function (number of matrix rows)
scalarFunction - Function to apply to each output

DifferentiableGeneralizedLinearModel

public DifferentiableGeneralizedLinearModel(MultivariateDiscriminant matrixMultiply,
                                            DifferentiableVectorFunction squashingFunction)
Creates a new instance of DifferentiableGeneralizedLinearModel

Parameters:
matrixMultiply - GradientDescendable that multiplies an input by the internal matrix
squashingFunction - VectorFunction that is applied to the output of the matrix multiply

DifferentiableGeneralizedLinearModel

public DifferentiableGeneralizedLinearModel(MultivariateDiscriminant matrixMultiply,
                                            DifferentiableUnivariateScalarFunction scalarSquashingFunction)
Creates a new instance of DifferentiableGeneralizedLinearModel

Parameters:
matrixMultiply - GradientDescendable that multiplies an input by the internal matrix
scalarSquashingFunction - scalar function that is applied to the output of the matrix multiply

DifferentiableGeneralizedLinearModel

public DifferentiableGeneralizedLinearModel(DifferentiableGeneralizedLinearModel other)
Creates a new instance of DifferentiableGeneralizedLinearModel

Parameters:
other - DifferentiableGeneralizedLinearModel to copy
Method Detail

getSquashingFunction

public DifferentiableVectorFunction getSquashingFunction()
Description copied from class: GeneralizedLinearModel
Getter for squashingFunction

Overrides:
getSquashingFunction in class GeneralizedLinearModel
Returns:
VectorFunction that is applied to the output of the matrix multiply

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>
Parameters:
input - Point about which to differentiate w.r.t. the parameters
Returns:
Matrix of parameter gradients

clone

public DifferentiableGeneralizedLinearModel 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 GeneralizedLinearModel
Returns:
A clone of this object.

differentiate

public Matrix differentiate(Vector input)
Description copied from interface: DifferentiableVectorFunction
Differentiate the VectorFunction at input and return the Jacobian

Specified by:
differentiate in interface DifferentiableEvaluator<Vector,Vector,Matrix>
Specified by:
differentiate in interface DifferentiableVectorFunction
Parameters:
input - Vector input to the VectorFunction, about which to evaluate the VectorFunction
Returns:
Jacobian at input