cc.mallet.grmm.util
Class CachingOptimizable.ByGradient

java.lang.Object
  extended by cc.mallet.grmm.util.CachingOptimizable.ByGradient
All Implemented Interfaces:
Optimizable, Optimizable.ByGradientValue
Direct Known Subclasses:
PiecewiseACRFTrainer.Maxable, PseudolikelihoodACRFTrainer.Maxable, PwplACRFTrainer.Maxable
Enclosing class:
CachingOptimizable

public abstract static class CachingOptimizable.ByGradient
extends java.lang.Object
implements Optimizable.ByGradientValue


Nested Class Summary
 
Nested classes/interfaces inherited from interface cc.mallet.optimize.Optimizable
Optimizable.ByBatchGradient, Optimizable.ByCombiningBatchGradient, Optimizable.ByGISUpdate, Optimizable.ByGradient, Optimizable.ByGradientValue, Optimizable.ByHessian, Optimizable.ByValue, Optimizable.ByVotedPerceptron
 
Constructor Summary
CachingOptimizable.ByGradient()
           
 
Method Summary
protected abstract  double computeValue()
           
protected abstract  void computeValueGradient(double[] buffer)
           
 double getValue()
           
 void getValueGradient(double[] buffer)
           
protected  void setCachedGradient(double[] gradient)
          Sets the cached gradient.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface cc.mallet.optimize.Optimizable
getNumParameters, getParameter, getParameters, setParameter, setParameters
 

Constructor Detail

CachingOptimizable.ByGradient

public CachingOptimizable.ByGradient()
Method Detail

computeValue

protected abstract double computeValue()

computeValueGradient

protected abstract void computeValueGradient(double[] buffer)

getValueGradient

public void getValueGradient(double[] buffer)
Specified by:
getValueGradient in interface Optimizable.ByGradientValue

getValue

public double getValue()
Specified by:
getValue in interface Optimizable.ByGradientValue

setCachedGradient

protected void setCachedGradient(double[] gradient)
Sets the cached gradient. This is useful for subclasses that need to compute the value and the gradient at the same time. If they call this method in computeValue(), then their computeValueGradient() will never be called.

Parameters:
gradient -