Package edu.stanford.nlp.classify
Class LogPrior
- java.lang.Object
-
- edu.stanford.nlp.classify.LogPrior
-
- All Implemented Interfaces:
Serializable
public class LogPrior extends Object implements Serializable
A Prior for functions. Immutable.- Author:
- Galen Andrew
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLogPrior.LogPriorType
-
Constructor Summary
Constructors Constructor Description LogPrior()LogPrior(double[] C)IMPORTANT NOTE: This constructor allows non-uniform regularization, but it transforms the inputs C (like the machine learning people like) to sigma (like we NLP folks like).LogPrior(int intPrior)LogPrior(int intPrior, double sigma, double epsilon)LogPrior(LogPrior.LogPriorType type)LogPrior(LogPrior.LogPriorType type, double sigma, double epsilon)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description doublecompute(double[] x, double[] grad)Adjust the given grad array by adding the prior's gradient component and return the value of the logPriordoublecomputeStochastic(double[] x, double[] grad, double fractionOfData)static LogPriorgetAdaptationPrior(double[] means, LogPrior otherPrior)doublegetEpsilon()doublegetSigma()doublegetSigmaSquared()double[]getSigmaSquaredM()LogPrior.LogPriorTypegetType()static LogPrior.LogPriorTypegetType(String name)voidsetEpsilon(double epsilon)voidsetSigma(double sigma)voidsetSigmaSquared(double sigmaSq)voidsetSigmaSquaredM(double[] sigmaSq)
-
-
-
Constructor Detail
-
LogPrior
public LogPrior()
-
LogPrior
public LogPrior(int intPrior)
-
LogPrior
public LogPrior(LogPrior.LogPriorType type)
-
LogPrior
public LogPrior(int intPrior, double sigma, double epsilon)
-
LogPrior
public LogPrior(LogPrior.LogPriorType type, double sigma, double epsilon)
-
LogPrior
public LogPrior(double[] C)
IMPORTANT NOTE: This constructor allows non-uniform regularization, but it transforms the inputs C (like the machine learning people like) to sigma (like we NLP folks like). C = 1/\sigma^2
-
-
Method Detail
-
getType
public static LogPrior.LogPriorType getType(String name)
-
getType
public LogPrior.LogPriorType getType()
-
getSigma
public double getSigma()
-
getSigmaSquared
public double getSigmaSquared()
-
getSigmaSquaredM
public double[] getSigmaSquaredM()
-
getEpsilon
public double getEpsilon()
-
setSigma
public void setSigma(double sigma)
-
setSigmaSquared
public void setSigmaSquared(double sigmaSq)
-
setSigmaSquaredM
public void setSigmaSquaredM(double[] sigmaSq)
-
setEpsilon
public void setEpsilon(double epsilon)
-
computeStochastic
public double computeStochastic(double[] x, double[] grad, double fractionOfData)
-
compute
public double compute(double[] x, double[] grad)Adjust the given grad array by adding the prior's gradient component and return the value of the logPrior- Parameters:
x- the input pointgrad- the gradient array- Returns:
- the value
-
-