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

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
                  extended by gov.sandia.cognition.learning.function.scalar.LinearDiscriminantWithBias
All Implemented Interfaces:
Evaluator<Vectorizable,Double>, VectorInputEvaluator<Vectorizable,Double>, Vectorizable, ScalarFunction<Vectorizable>, CloneableSerializable, Serializable, Cloneable

public class LinearDiscriminantWithBias
extends LinearDiscriminant

A LinearDiscriminant with an additional bias term that gets added to the output of the dot product.

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

Field Summary
protected  double bias
          Bias term that gets added to the output of the dot product.
 
Fields inherited from class gov.sandia.cognition.learning.function.scalar.LinearDiscriminant
weightVector
 
Constructor Summary
LinearDiscriminantWithBias()
          Creates a new instance of LinearDiscriminantWithBias
LinearDiscriminantWithBias(Vector weightVector)
          Creates a new instance of LinearClassifier
LinearDiscriminantWithBias(Vector weightVector, double bias)
          Creates a new instance of LinearClassifier
 
Method Summary
 LinearDiscriminantWithBias 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 evaluate(Vectorizable input)
          Returns the result of calling evaluateAsDouble.
 double getBias()
          Getter for bias.
 void setBias(double bias)
          Setter for bias.
 
Methods inherited from class gov.sandia.cognition.learning.function.scalar.LinearDiscriminant
evaluateAsDouble, getInputDimensionality, getWeightVector, setWeightVector
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bias

protected double bias
Bias term that gets added to the output of the dot product.

Constructor Detail

LinearDiscriminantWithBias

public LinearDiscriminantWithBias()
Creates a new instance of LinearDiscriminantWithBias


LinearDiscriminantWithBias

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

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

LinearDiscriminantWithBias

public LinearDiscriminantWithBias(Vector weightVector,
                                  double bias)
Creates a new instance of LinearClassifier

Parameters:
weightVector - Weight Vector to dot-product with the input
bias - Bias term that gets added to the output of the dot product.
Method Detail

clone

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

getBias

public double getBias()
Getter for bias.

Returns:
Bias term that gets added to the output of the dot product.

setBias

public void setBias(double bias)
Setter for bias.

Parameters:
bias - Bias term that gets added to the output of the dot product.

evaluate

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

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

convertToVector

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

Specified by:
convertToVector in interface Vectorizable
Overrides:
convertToVector in class LinearDiscriminant
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
Overrides:
convertFromVector in class LinearDiscriminant
Parameters:
parameters - The parameters to incorporate.