Package cc.mallet.fst.semi_supervised.pr
Class ConstraintsOptimizableByPR
- java.lang.Object
-
- cc.mallet.fst.semi_supervised.pr.ConstraintsOptimizableByPR
-
- All Implemented Interfaces:
Optimizable
,Optimizable.ByGradientValue
,java.io.Serializable
public class ConstraintsOptimizableByPR extends java.lang.Object implements java.io.Serializable, Optimizable.ByGradientValue
Optimizable for E-step/I-projection in Posterior Regularization (PR).- Author:
- Kedar Bellare, Gregory Druck
- See Also:
- Serialized Form
-
-
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
-
-
Field Summary
Fields Modifier and Type Field Description protected double[][][][]
cachedDots
protected double[]
cachedGradient
protected double
cachedValue
protected boolean
cacheStale
protected CRF
crf
protected java.util.concurrent.ThreadPoolExecutor
executor
protected int
numParameters
protected int
numThreads
protected InstanceList
trainingSet
-
Constructor Summary
Constructors Constructor Description ConstraintsOptimizableByPR(CRF crf, InstanceList ilist, PRAuxiliaryModel model)
ConstraintsOptimizableByPR(CRF crf, InstanceList ilist, PRAuxiliaryModel model, int numThreads)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cacheDotProducts()
PRAuxiliaryModel
getAuxModel()
double[][][][]
getCachedDots()
double
getCompleteValueContribution()
protected double
getExpectationValue()
int
getNumParameters()
double
getParameter(int index)
void
getParameters(double[] params)
double
getValue()
Returns the log probability of the training sequence labels and the prior over parameters.void
getValueGradient(double[] buffer)
void
setParameter(int index, double value)
void
setParameters(double[] params)
void
shutdown()
-
-
-
Field Detail
-
cacheStale
protected boolean cacheStale
-
numParameters
protected int numParameters
-
numThreads
protected int numThreads
-
trainingSet
protected InstanceList trainingSet
-
cachedValue
protected double cachedValue
-
cachedGradient
protected double[] cachedGradient
-
crf
protected CRF crf
-
executor
protected java.util.concurrent.ThreadPoolExecutor executor
-
cachedDots
protected double[][][][] cachedDots
-
-
Constructor Detail
-
ConstraintsOptimizableByPR
public ConstraintsOptimizableByPR(CRF crf, InstanceList ilist, PRAuxiliaryModel model)
-
ConstraintsOptimizableByPR
public ConstraintsOptimizableByPR(CRF crf, InstanceList ilist, PRAuxiliaryModel model, int numThreads)
-
-
Method Detail
-
cacheDotProducts
public void cacheDotProducts()
-
getNumParameters
public int getNumParameters()
- Specified by:
getNumParameters
in interfaceOptimizable
-
getParameters
public void getParameters(double[] params)
- Specified by:
getParameters
in interfaceOptimizable
-
getParameter
public double getParameter(int index)
- Specified by:
getParameter
in interfaceOptimizable
-
setParameters
public void setParameters(double[] params)
- Specified by:
setParameters
in interfaceOptimizable
-
setParameter
public void setParameter(int index, double value)
- Specified by:
setParameter
in interfaceOptimizable
-
getExpectationValue
protected double getExpectationValue()
-
getValue
public double getValue()
Returns the log probability of the training sequence labels and the prior over parameters.- Specified by:
getValue
in interfaceOptimizable.ByGradientValue
-
getCompleteValueContribution
public double getCompleteValueContribution()
-
getValueGradient
public void getValueGradient(double[] buffer)
- Specified by:
getValueGradient
in interfaceOptimizable.ByGradientValue
-
shutdown
public void shutdown()
-
getCachedDots
public double[][][][] getCachedDots()
-
getAuxModel
public PRAuxiliaryModel getAuxModel()
-
-