gov.sandia.cognition.learning.algorithm.svm
Class SuccessiveOverrelaxation.Entry

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.util.AbstractWeighted
          extended by gov.sandia.cognition.util.DefaultWeightedValue<InputType>
              extended by gov.sandia.cognition.learning.algorithm.svm.SuccessiveOverrelaxation.Entry
All Implemented Interfaces:
CloneableSerializable, Weighted, WeightedValue<InputType>, Serializable, Cloneable, Comparable<SuccessiveOverrelaxation.Entry>
Enclosing class:
SuccessiveOverrelaxation<InputType>

protected class SuccessiveOverrelaxation.Entry
extends DefaultWeightedValue<InputType>
implements Comparable<SuccessiveOverrelaxation.Entry>

The Entry class represents the data that the algorithm keeps about each training example.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class gov.sandia.cognition.util.DefaultWeightedValue
DefaultWeightedValue.WeightComparator
 
Field Summary
protected  InputOutputPair<? extends InputType,? extends Boolean> example
          The example the data pertains to.
protected  boolean output
          The output represented as a raw boolean, to enforce that the label exists.
protected  double outputDouble
          The output converted to a double form (+1.0 or -1.0).
protected  double previousStepWeight
          The weight of the entry on the previous step.
protected  double selfKernel
          This is the value of the kernel applied to the example and itself.
protected  boolean supportInserted
          Indicates if the support vector has been inserted into the map of support vectors or not.
 
Fields inherited from class gov.sandia.cognition.util.DefaultWeightedValue
value
 
Fields inherited from class gov.sandia.cognition.util.AbstractWeighted
DEFAULT_WEIGHT, weight
 
Constructor Summary
protected SuccessiveOverrelaxation.Entry(InputOutputPair<? extends InputType,? extends Boolean> example)
          Creates a new Entry for the given example.
 
Method Summary
 int compareTo(SuccessiveOverrelaxation.Entry other)
          Compares this entry to another one by comparing the weights.
 InputType getInput()
          Gets the input that the data belongs to.
 boolean getOutput()
          Gets the output value of the entry as a boolean.
 double getUnlabeledWeight()
          Gets the unlabeled weight.
 void setUnlabeledWeight(double unlabeledWeight)
          Sets the unlabeled weight.
 
Methods inherited from class gov.sandia.cognition.util.DefaultWeightedValue
clone, create, getValue, setValue
 
Methods inherited from class gov.sandia.cognition.util.AbstractWeighted
getWeight, setWeight
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.util.Weighted
getWeight
 

Field Detail

example

protected InputOutputPair<? extends InputType,? extends Boolean> example
The example the data pertains to.


output

protected boolean output
The output represented as a raw boolean, to enforce that the label exists.


outputDouble

protected double outputDouble
The output converted to a double form (+1.0 or -1.0).


supportInserted

protected boolean supportInserted
Indicates if the support vector has been inserted into the map of support vectors or not. This allows us to keep the supports map to only contain the entries whose weights are non-zero.


selfKernel

protected double selfKernel
This is the value of the kernel applied to the example and itself. We use this value in the update step, so we can cache it for a performance boost.


previousStepWeight

protected double previousStepWeight
The weight of the entry on the previous step. This is used at the end of the step to calculate the total change of weights in the step.

Constructor Detail

SuccessiveOverrelaxation.Entry

protected SuccessiveOverrelaxation.Entry(InputOutputPair<? extends InputType,? extends Boolean> example)
Creates a new Entry for the given example.

Parameters:
example - The example to create the entry for.
Method Detail

getInput

public InputType getInput()
Gets the input that the data belongs to.

Returns:
The input.

getOutput

public boolean getOutput()
Gets the output value of the entry as a boolean.

Returns:
The output.

setUnlabeledWeight

public void setUnlabeledWeight(double unlabeledWeight)
Sets the unlabeled weight. This means that the label is applied to the weight when it is set. Must be non-negative.

Parameters:
unlabeledWeight - The unlabeled weight.

getUnlabeledWeight

public double getUnlabeledWeight()
Gets the unlabeled weight. This means that the label part of the weight value is removed. This means a non-negative value is returned.

Returns:
The unlabeled weight.

compareTo

public int compareTo(SuccessiveOverrelaxation.Entry other)
Compares this entry to another one by comparing the weights.

Specified by:
compareTo in interface Comparable<SuccessiveOverrelaxation.Entry>
Parameters:
other - The entry to compare to.
Returns:
The comparison based on weight.