public class PerceptronModel extends BaseModel
Constructor and Description |
---|
PerceptronModel(PerceptronModel other) |
PerceptronModel(ShiftReduceOptions op,
Index<Transition> transitionIndex,
java.util.Set<java.lang.String> knownStates,
java.util.Set<java.lang.String> rootStates,
java.util.Set<java.lang.String> rootOnlyStates) |
Modifier and Type | Method and Description |
---|---|
void |
averageModels(java.util.Collection<PerceptronModel> models) |
void |
averageScoredModels(java.util.Collection<ScoredObject<PerceptronModel>> scoredModels) |
java.util.Collection<ScoredObject<java.lang.Integer>> |
findHighestScoringTransitions(State state,
boolean requireLegal,
int numTransitions,
java.util.List<ParserConstraint> constraints) |
void |
outputStats()
Output some random facts about the model
|
void |
trainModel(java.lang.String serializedPath,
Tagger tagger,
java.util.Random random,
java.util.List<Tree> binarizedTrees,
java.util.List<java.util.List<Transition>> transitionLists,
Treebank devTreebank,
int nThreads)
Will train the model on the given treebank, using devTreebank as
a dev set.
|
findEmergencyTransition
public PerceptronModel(ShiftReduceOptions op, Index<Transition> transitionIndex, java.util.Set<java.lang.String> knownStates, java.util.Set<java.lang.String> rootStates, java.util.Set<java.lang.String> rootOnlyStates)
public PerceptronModel(PerceptronModel other)
public void averageScoredModels(java.util.Collection<ScoredObject<PerceptronModel>> scoredModels)
public void averageModels(java.util.Collection<PerceptronModel> models)
public void outputStats()
public java.util.Collection<ScoredObject<java.lang.Integer>> findHighestScoringTransitions(State state, boolean requireLegal, int numTransitions, java.util.List<ParserConstraint> constraints)
findHighestScoringTransitions
in class BaseModel
public void trainModel(java.lang.String serializedPath, Tagger tagger, java.util.Random random, java.util.List<Tree> binarizedTrees, java.util.List<java.util.List<Transition>> transitionLists, Treebank devTreebank, int nThreads)
trainModel
in class BaseModel
serializedPath
- Where serialized models go. If the appropriate options are set, the method can use this to save intermediate models.tagger
- The tagger to use when evaluating devTreebank. TODO: it would make more sense for ShiftReduceParser to retag the trees firstrandom
- A random number generator to use for any random numbers. Useful to make sure results can be reproduced.binarizedTrees
- The treebank to train from.transitionLists
- binarizedTrainTrees converted into lists of transitions that will reproduce the same tree.devTreebank
- a set of trees which can be used for dev testing (assuming the user provided a dev treebank)nThreads
- how many threads the model can use for training