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

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.math.AbstractScalarFunction<InputType>
          extended by gov.sandia.cognition.learning.function.regression.AbstractRegressor<Vectorizable>
              extended by gov.sandia.cognition.learning.function.scalar.LinearDiscriminant
All Implemented Interfaces:
Evaluator<Vectorizable,Double>, VectorInputEvaluator<Vectorizable,Double>, Vectorizable, ScalarFunction<Vectorizable>, CloneableSerializable, Serializable, Cloneable
Direct Known Subclasses:
LinearDiscriminantWithBias

public class LinearDiscriminant
extends AbstractRegressor<Vectorizable>
implements Vectorizable, VectorInputEvaluator<Vectorizable,Double>

LinearDiscriminant takes the dot product between the weight Vector and the input Vector. This is a mapping from the M-dimensional space to the scalar (real) space.

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

Field Summary
protected  Vector weightVector
          Weight Vector to dot-product with the input
 
Constructor Summary
LinearDiscriminant()
          Creates a new instance of LinearClassifier
LinearDiscriminant(Vector weightVector)
          Creates a new instance of LinearClassifier
 
Method Summary
 LinearDiscriminant clone()
          This makes public the clone method on the Object class and removes the exception that it throws.
 void convertFromVector(Vector parameters)
          Converts the object from a Vector of parameters.
 Vector convertToVector()
          Converts the object to a vector.
 double evaluateAsDouble(Vectorizable input)
          Evaluates the scalar function as a double.
 int getInputDimensionality()
          Gets the expected dimensionality of the input vector to the evaluator, if it is known.
 Vector getWeightVector()
          Getter for weightVector
 void setWeightVector(Vector weightVector)
          Setter for weightVector
 
Methods inherited from class gov.sandia.cognition.math.AbstractScalarFunction
evaluate
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.evaluator.Evaluator
evaluate
 

Field Detail

weightVector

protected Vector weightVector
Weight Vector to dot-product with the input

Constructor Detail

LinearDiscriminant

public LinearDiscriminant()
Creates a new instance of LinearClassifier


LinearDiscriminant

public LinearDiscriminant(Vector weightVector)
Creates a new instance of LinearClassifier

Parameters:
weightVector - Weight Vector to dot-product with the input
Method Detail

clone

public LinearDiscriminant 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.

getInputDimensionality

public int getInputDimensionality()
Description copied from interface: VectorInputEvaluator
Gets the expected dimensionality of the input vector to the evaluator, if it is known. If it is not known, -1 is returned.

Specified by:
getInputDimensionality in interface VectorInputEvaluator<Vectorizable,Double>
Returns:
The expected dimensionality of the input vector to the evaluator, or -1 if it is not known.

getWeightVector

public Vector getWeightVector()
Getter for weightVector

Returns:
Weight Vector to dot-product with the input

setWeightVector

public void setWeightVector(Vector weightVector)
Setter for weightVector

Parameters:
weightVector - Weight Vector to dot-product with the input

evaluateAsDouble

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

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

convertToVector

public Vector convertToVector()
Description copied from interface: Vectorizable
Converts the object to a vector.

Specified by:
convertToVector in interface Vectorizable
Returns:
The Vector form of the object.

convertFromVector

public void convertFromVector(Vector parameters)
Description copied from interface: Vectorizable
Converts the object from a Vector of parameters.

Specified by:
convertFromVector in interface Vectorizable
Parameters:
parameters - The parameters to incorporate.