|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.maxent.CGRunner
public class CGRunner
This class will call an optimization method such as Conjugate Gradient or Quasi-Newton on a LambdaSolve object to find optimal parameters, including imposing a Gaussian prior on those parameters.
Constructor Summary | |
---|---|
CGRunner(LambdaSolve prob,
String filename)
Set up a LambdaSolve problem for solution by Conjugate Gradient. |
|
CGRunner(LambdaSolve prob,
String filename,
double priorSigmaS)
Set up a LambdaSolve problem for solution by Conjugate Gradient, specifying a value for sigma2. |
|
CGRunner(LambdaSolve prob,
String filename,
double tol,
double priorSigmaS)
Set up a LambdaSolve problem for solution by Conjugate Gradient. |
|
CGRunner(LambdaSolve prob,
String filename,
double tol,
double[] sigmaSquareds)
Set up a LambdaSolve problem for solution by Conjugate Gradient. |
Method Summary | |
---|---|
void |
solve()
Solves the problem using QN. |
void |
solveCG()
Solves the problem using CG. |
void |
solveL1(double weight)
Solves the problem using OWLQN. |
void |
solveQN()
Solves the problem using QN. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CGRunner(LambdaSolve prob, String filename)
prob
- The problem to solvefilename
- Used (with extension) to save intermediate results.public CGRunner(LambdaSolve prob, String filename, double priorSigmaS)
prob
- The problem to solvefilename
- Used (with extension) to save intermediate results.priorSigmaS
- The prior sigma2: this doubled will be
used to divide the lambda2 values as the
prior penalty in the likelihood. A value of 0.0
or Double.POSITIVE_INFINITY
indicates to not use regularization.public CGRunner(LambdaSolve prob, String filename, double tol, double priorSigmaS)
prob
- The problem to solvefilename
- Used (with extension) to save intermediate results.tol
- Tolerance of errors (passed to CG)priorSigmaS
- The prior sigma2: this doubled will be
used to divide the lambda2 values as the
prior penalty. A value of 0.0
or Double.POSITIVE_INFINITY
indicates to not use regularization.public CGRunner(LambdaSolve prob, String filename, double tol, double[] sigmaSquareds)
prob
- The problem to solvefilename
- Used (with extension) to save intermediate results.tol
- Tolerance of errors (passed to CG)sigmaSquareds
- The prior sigma2 for eah feature: this doubled will be
used to divide the lambda2 values as the
prior penalty. This array must have size the number of features.
If it is null, no regularization will be performed.Method Detail |
---|
public void solve()
lambda
array of prob
.
public void solveQN()
lambda
array of prob
.
public void solveCG()
lambda
array of prob
.
public void solveL1(double weight)
lambda
array of prob
. Note that the
likelihood function will be a penalized L2 likelihood function unless you
have turned this off via setting the priorSigmaS to 0.0.
weight
- Controls the sparseness/regularization of the L1 solution.
The bigger the number the sparser the solution. Weights between
0.01 and 1.0 typically give good performance.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |