gov.sandia.cognition.learning.algorithm.perceptron
Class OnlineRampPassiveAggressivePerceptron

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,LinearBinaryCategorizer>
              extended by gov.sandia.cognition.learning.algorithm.perceptron.AbstractOnlineLinearBinaryCategorizerLearner
                  extended by gov.sandia.cognition.learning.algorithm.perceptron.AbstractKernelizableBinaryCategorizerOnlineLearner
                      extended by gov.sandia.cognition.learning.algorithm.perceptron.AbstractLinearCombinationOnlineLearner
                          extended by gov.sandia.cognition.learning.algorithm.perceptron.OnlinePassiveAggressivePerceptron
                              extended by gov.sandia.cognition.learning.algorithm.perceptron.OnlinePassiveAggressivePerceptron.AbstractSoftMargin
                                  extended by gov.sandia.cognition.learning.algorithm.perceptron.OnlinePassiveAggressivePerceptron.QuadraticSoftMargin
                                      extended by gov.sandia.cognition.learning.algorithm.perceptron.OnlineRampPassiveAggressivePerceptron
All Implemented Interfaces:
BatchAndIncrementalLearner<InputOutputPair<? extends Vectorizable,Boolean>,LinearBinaryCategorizer>, BatchLearner<Collection<? extends InputOutputPair<? extends Vectorizable,Boolean>>,LinearBinaryCategorizer>, IncrementalLearner<InputOutputPair<? extends Vectorizable,Boolean>,LinearBinaryCategorizer>, KernelizableBinaryCategorizerOnlineLearner, SupervisedBatchAndIncrementalLearner<Vectorizable,Boolean,LinearBinaryCategorizer>, SupervisedBatchLearner<Vectorizable,Boolean,LinearBinaryCategorizer>, SupervisedIncrementalLearner<Vectorizable,Boolean,LinearBinaryCategorizer>, VectorFactoryContainer, CloneableSerializable, Serializable, Cloneable

@PublicationReference(title="Online Passive-Aggressive Algorithms on a Budget",
                      author={"Zhuang Wang","Slobodan Vucetic"},
                      year=2010,
                      type=Conference,
                      publication="Proceedings of the 13th International Conference on Artificial Intelligence and Statistics (AISTATS)",
                      url="http://jmlr.csail.mit.edu/proceedings/papers/v9/wang10b/wang10b.pdf",
                      notes="This presents the PA-I-R algorithm. This implementation is non-budgeted form. We this also implements PA-R and PA-II-R")
public class OnlineRampPassiveAggressivePerceptron
extends OnlinePassiveAggressivePerceptron.QuadraticSoftMargin

An implementation of the Ramp Loss Passive Aggressive Perceptron (PA^R) from the referenced paper. It is an extension of the quadratic soft margin version of PA (PA-II) that replaces the hinge loss with a ramp loss. This ends up only changing the determination of when an update is made but does not change how the update is made.

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

Nested Class Summary
 
Nested classes/interfaces inherited from class gov.sandia.cognition.learning.algorithm.perceptron.OnlinePassiveAggressivePerceptron
OnlinePassiveAggressivePerceptron.AbstractSoftMargin, OnlinePassiveAggressivePerceptron.LinearSoftMargin, OnlinePassiveAggressivePerceptron.QuadraticSoftMargin
 
Field Summary
 
Fields inherited from class gov.sandia.cognition.learning.algorithm.perceptron.OnlinePassiveAggressivePerceptron.AbstractSoftMargin
aggressiveness, DEFAULT_AGGRESSIVENESS
 
Fields inherited from class gov.sandia.cognition.learning.algorithm.perceptron.OnlinePassiveAggressivePerceptron
DEFAULT_UPDATE_BIAS
 
Fields inherited from class gov.sandia.cognition.learning.algorithm.perceptron.AbstractLinearCombinationOnlineLearner
updateBias
 
Fields inherited from class gov.sandia.cognition.learning.algorithm.perceptron.AbstractOnlineLinearBinaryCategorizerLearner
vectorFactory
 
Constructor Summary
OnlineRampPassiveAggressivePerceptron()
          Creates a new OnlineRampPassiveAggressivePerceptron with default parameters.
OnlineRampPassiveAggressivePerceptron(double aggressiveness)
          Creates a new OnlineRampPassiveAggressivePerceptron with the given aggressiveness.
OnlineRampPassiveAggressivePerceptron(double aggressiveness, VectorFactory<?> vectorFactory)
          Creates a new OnlineRampPassiveAggressivePerceptron with the given parameters.
 
Method Summary
<InputType>
double
computeUpdate(DefaultKernelBinaryCategorizer<InputType> target, InputType input, boolean actualCategory, double predicted)
          Compute the update weight in the linear case.
 double computeUpdate(LinearBinaryCategorizer target, Vector input, boolean actualCategory, double predicted)
          Compute the update weight in the linear case.
 
Methods inherited from class gov.sandia.cognition.learning.algorithm.perceptron.OnlinePassiveAggressivePerceptron.QuadraticSoftMargin
computeUpdate
 
Methods inherited from class gov.sandia.cognition.learning.algorithm.perceptron.OnlinePassiveAggressivePerceptron.AbstractSoftMargin
getAggressiveness, setAggressiveness
 
Methods inherited from class gov.sandia.cognition.learning.algorithm.perceptron.AbstractLinearCombinationOnlineLearner
computeDecay, computeDecay, computeRescaling, computeRescaling, createInitialLearnedObject, initialize, initialize, isUpdateBias, setUpdateBias, update, update
 
Methods inherited from class gov.sandia.cognition.learning.algorithm.perceptron.AbstractKernelizableBinaryCategorizerOnlineLearner
createKernelLearner, learn, update, update, update
 
Methods inherited from class gov.sandia.cognition.learning.algorithm.perceptron.AbstractOnlineLinearBinaryCategorizerLearner
createInitialLearnedObject, getVectorFactory, setVectorFactory, update
 
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.SupervisedIncrementalLearner
update
 
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
createInitialLearnedObject, update, update
 
Methods inherited from interface gov.sandia.cognition.util.CloneableSerializable
clone
 

Constructor Detail

OnlineRampPassiveAggressivePerceptron

public OnlineRampPassiveAggressivePerceptron()
Creates a new OnlineRampPassiveAggressivePerceptron with default parameters.


OnlineRampPassiveAggressivePerceptron

public OnlineRampPassiveAggressivePerceptron(double aggressiveness)
Creates a new OnlineRampPassiveAggressivePerceptron with the given aggressiveness.

Parameters:
aggressiveness - The aggressiveness. Must be positive.

OnlineRampPassiveAggressivePerceptron

public OnlineRampPassiveAggressivePerceptron(double aggressiveness,
                                             VectorFactory<?> vectorFactory)
Creates a new OnlineRampPassiveAggressivePerceptron with the given parameters.

Parameters:
aggressiveness - The aggressiveness. Must be positive.
vectorFactory - The factory to use to create new weight vectors.
Method Detail

computeUpdate

public double computeUpdate(LinearBinaryCategorizer target,
                            Vector input,
                            boolean actualCategory,
                            double predicted)
Description copied from class: AbstractLinearCombinationOnlineLearner
Compute the update weight in the linear case. Must be implemented by subclasses.

Overrides:
computeUpdate in class OnlinePassiveAggressivePerceptron
Parameters:
target - Target to compute the update for.
input - Input to use in computing the update.
actualCategory - The actual category of the input.
predicted - The predicted category of the input.
Returns:
The update weight for how much to add the input to the target. May be zero if no update is needed.

computeUpdate

public <InputType> double computeUpdate(DefaultKernelBinaryCategorizer<InputType> target,
                                        InputType input,
                                        boolean actualCategory,
                                        double predicted)
Description copied from class: AbstractLinearCombinationOnlineLearner
Compute the update weight in the linear case. Must be implemented by subclasses.

Overrides:
computeUpdate in class OnlinePassiveAggressivePerceptron
Type Parameters:
InputType - The input value for learning.
Parameters:
target - Target to compute the update for.
input - Input to use in computing the update.
actualCategory - The actual category of the input.
predicted - The predicted category of the input.
Returns:
The update weight for how much to add the input to the target. May be zero if no update is needed.