gov.sandia.cognition.learning.algorithm.confidence
Class ConfidenceWeightedDiagonalDeviation

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.learning.algorithm.AbstractBatchAndIncrementalLearner<InputOutputPair<? extends InputType,OutputType>,ResultType>
          extended by gov.sandia.cognition.learning.algorithm.AbstractSupervisedBatchAndIncrementalLearner<Vectorizable,Boolean,DiagonalConfidenceWeightedBinaryCategorizer>
              extended by gov.sandia.cognition.learning.algorithm.confidence.ConfidenceWeightedDiagonalDeviation
All Implemented Interfaces:
BatchAndIncrementalLearner<InputOutputPair<? extends Vectorizable,Boolean>,DiagonalConfidenceWeightedBinaryCategorizer>, BatchLearner<Collection<? extends InputOutputPair<? extends Vectorizable,Boolean>>,DiagonalConfidenceWeightedBinaryCategorizer>, IncrementalLearner<InputOutputPair<? extends Vectorizable,Boolean>,DiagonalConfidenceWeightedBinaryCategorizer>, SupervisedBatchAndIncrementalLearner<Vectorizable,Boolean,DiagonalConfidenceWeightedBinaryCategorizer>, SupervisedBatchLearner<Vectorizable,Boolean,DiagonalConfidenceWeightedBinaryCategorizer>, SupervisedIncrementalLearner<Vectorizable,Boolean,DiagonalConfidenceWeightedBinaryCategorizer>, CloneableSerializable, Serializable, Cloneable
Direct Known Subclasses:
ConfidenceWeightedDiagonalDeviationProject

@PublicationReference(author={"Koby Crammer","Mark Dredze","Fernando Pereira"},
                      title="Exact Convex Confidence-Weighted Learning",
                      year=2008,
                      type=Conference,
                      publication="Advances in Neural Information Processing Systems",
                      url="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.169.3364")
public class ConfidenceWeightedDiagonalDeviation
extends AbstractSupervisedBatchAndIncrementalLearner<Vectorizable,Boolean,DiagonalConfidenceWeightedBinaryCategorizer>

An implementation of the Standard Deviation (Stdev) algorithm for learning a confidence-weighted categorizer. It updates only the diagonal of the covariance matrix, thus computing the variance for each dimension. This corresponds to the "Stdev-drop" version.

Since:
3.3.0
Author:
Justin Basilico
See Also:
Serialized Form

Field Summary
protected  double confidence
          The confidence to use for updating.
static double DEFAULT_CONFIDENCE
          The default confidence is 0.85.
static double DEFAULT_DEFAULT_VARIANCE
          The default variance is 1.0.
protected  double defaultVariance
          The default variance, which the diagonal of the covariance matrix is initialized to.
protected  double epsilon
          Epsilon is the cached value 1 + phi^2.
protected  double phi
          Phi is the standard score computed from the confidence.
protected  double psi
          Psi is the cached value 1 + phi^2 / 2.
 
Constructor Summary
ConfidenceWeightedDiagonalDeviation()
          Creates a new ConfidenceWeightedDiagonalVariance with default parameters.
ConfidenceWeightedDiagonalDeviation(double confidence, double defaultVariance)
          Creates a new ConfidenceWeightedDiagonalVariance with the given parameters.
 
Method Summary
 DiagonalConfidenceWeightedBinaryCategorizer createInitialLearnedObject()
          Creates a new initial learned object, before any data is given.
 double getConfidence()
          Gets the confidence to use for updating.
 double getDefaultVariance()
          Gets the default variance, which the diagonal of the covariance matrix is initialized to.
 void setConfidence(double confidence)
          Gets the confidence to use for updating.
 void setDefaultVariance(double defaultVariance)
          Sets the default variance, which the diagonal of the covariance matrix is initialized to.
 void update(DiagonalConfidenceWeightedBinaryCategorizer target, Vector input, boolean label)
          Updates the target using the given input and associated label.
 void update(DiagonalConfidenceWeightedBinaryCategorizer target, Vectorizable input, Boolean output)
          The update method updates an object of ResultType using the given a new supervised input-output pair, using some form of "learning" algorithm.
 
Methods inherited from class gov.sandia.cognition.learning.algorithm.AbstractSupervisedBatchAndIncrementalLearner
update
 
Methods inherited from class gov.sandia.cognition.learning.algorithm.AbstractBatchAndIncrementalLearner
clone, learn, learn, update
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.learning.algorithm.BatchAndIncrementalLearner
learn
 
Methods inherited from interface gov.sandia.cognition.learning.algorithm.BatchLearner
learn
 
Methods inherited from interface gov.sandia.cognition.learning.algorithm.IncrementalLearner
update
 
Methods inherited from interface gov.sandia.cognition.util.CloneableSerializable
clone
 

Field Detail

DEFAULT_CONFIDENCE

public static final double DEFAULT_CONFIDENCE
The default confidence is 0.85.

See Also:
Constant Field Values

DEFAULT_DEFAULT_VARIANCE

public static final double DEFAULT_DEFAULT_VARIANCE
The default variance is 1.0.

See Also:
Constant Field Values

confidence

protected double confidence
The confidence to use for updating. Must be in [0.5, 1]. Called eta in the paper.


defaultVariance

protected double defaultVariance
The default variance, which the diagonal of the covariance matrix is initialized to. Must be positive. Called a in the paper.


phi

protected double phi
Phi is the standard score computed from the confidence.


psi

protected double psi
Psi is the cached value 1 + phi^2 / 2.


epsilon

protected double epsilon
Epsilon is the cached value 1 + phi^2.

Constructor Detail

ConfidenceWeightedDiagonalDeviation

public ConfidenceWeightedDiagonalDeviation()
Creates a new ConfidenceWeightedDiagonalVariance with default parameters.


ConfidenceWeightedDiagonalDeviation

public ConfidenceWeightedDiagonalDeviation(double confidence,
                                           double defaultVariance)
Creates a new ConfidenceWeightedDiagonalVariance with the given parameters.

Parameters:
confidence - The confidence to use. Must be in [0, 1].
defaultVariance - The default value to initialize the covariance matrix to.
Method Detail

createInitialLearnedObject

public DiagonalConfidenceWeightedBinaryCategorizer createInitialLearnedObject()
Description copied from interface: IncrementalLearner
Creates a new initial learned object, before any data is given.

Returns:
The initial learned object.

update

public void update(DiagonalConfidenceWeightedBinaryCategorizer target,
                   Vectorizable input,
                   Boolean output)
Description copied from interface: SupervisedIncrementalLearner
The update method updates an object of ResultType using the given a new supervised input-output pair, using some form of "learning" algorithm.

Parameters:
target - The object to update.
input - The supervised input to learn from.
output - The supervised output to learn from.

update

public void update(DiagonalConfidenceWeightedBinaryCategorizer target,
                   Vector input,
                   boolean label)
Updates the target using the given input and associated label.

Parameters:
target - The target to update.
input - The supervised input value.
label - The output label associated with the input.

getConfidence

public double getConfidence()
Gets the confidence to use for updating. Must be in [0.5, 1]. Called eta in the paper.

Returns:
The confidence.

setConfidence

public void setConfidence(double confidence)
Gets the confidence to use for updating. Must be in [0.5, 1]. Called eta in the paper.

Parameters:
confidence - The confidence. Must be between 0.5 and 1, inclusive.

getDefaultVariance

public double getDefaultVariance()
Gets the default variance, which the diagonal of the covariance matrix is initialized to. Must be positive. Called a in the paper.

Returns:
The default variance.

setDefaultVariance

public void setDefaultVariance(double defaultVariance)
Sets the default variance, which the diagonal of the covariance matrix is initialized to. Must be positive. Called a in the paper.

Parameters:
defaultVariance - The default variance. Must be positive.