public abstract class Lib extends Object implements LearningMethod
Modifier and Type | Class and Description |
---|---|
static class |
Lib.Verbostity |
Modifier and Type | Field and Description |
---|---|
protected FeatureMap |
featureMap |
protected MaltLibModel |
model |
protected Lib.Verbostity |
verbosity |
BATCH, CLASSIFY
Constructor and Description |
---|
Lib(InstanceModel owner,
Integer learnerMode,
String learningMethodName)
Constructs a Lib learner.
|
protected final Lib.Verbostity verbosity
protected final FeatureMap featureMap
protected MaltLibModel model
public Lib(InstanceModel owner, Integer learnerMode, String learningMethodName) throws MaltChainedException
owner
- the guide model ownerlearnerMode
- the mode of the learner BATCH or CLASSIFYMaltChainedException
public void addInstance(SingleDecision decision, FeatureVector featureVector) throws MaltChainedException
addInstance
in interface LearningMethod
MaltChainedException
public void finalizeSentence(DependencyStructure dependencyGraph) throws MaltChainedException
finalizeSentence
in interface LearningMethod
MaltChainedException
public void moveAllInstances(LearningMethod method, FeatureFunction divideFeature, ArrayList<Integer> divideFeatureIndexVector) throws MaltChainedException
moveAllInstances
in interface LearningMethod
MaltChainedException
public void noMoreInstances() throws MaltChainedException
noMoreInstances
in interface LearningMethod
MaltChainedException
public boolean predict(FeatureVector featureVector, SingleDecision decision) throws MaltChainedException
predict
in interface LearningMethod
MaltChainedException
public void train() throws MaltChainedException
train
in interface LearningMethod
MaltChainedException
protected abstract void trainExternal(String pathExternalTrain, LinkedHashMap<String,String> libOptions) throws MaltChainedException
MaltChainedException
protected abstract void trainInternal(LinkedHashMap<String,String> libOptions) throws MaltChainedException
MaltChainedException
public void terminate() throws MaltChainedException
terminate
in interface LearningMethod
MaltChainedException
public BufferedWriter getInstanceWriter()
getInstanceWriter
in interface LearningMethod
protected void closeInstanceWriter() throws MaltChainedException
MaltChainedException
public InstanceModel getOwner()
public int getLearnerMode()
public String getLearningMethodName()
public DependencyParserConfig getConfiguration() throws MaltChainedException
MaltChainedException
public int getNumberOfInstances() throws MaltChainedException
MaltChainedException
public void increaseNumberOfInstances()
increaseNumberOfInstances
in interface LearningMethod
public void decreaseNumberOfInstances()
decreaseNumberOfInstances
in interface LearningMethod
protected void setNumberOfInstances(int numberOfInstances)
protected OutputStreamWriter getInstanceOutputStreamWriter(String suffix) throws MaltChainedException
MaltChainedException
protected InputStreamReader getInstanceInputStreamReader(String suffix) throws MaltChainedException
MaltChainedException
protected InputStream getInputStreamFromConfigFileEntry(String suffix) throws MaltChainedException
MaltChainedException
protected File getFile(String suffix) throws MaltChainedException
MaltChainedException
protected Object getConfigFileEntryObject(String suffix) throws MaltChainedException
MaltChainedException
public String[] getLibParamStringArray(LinkedHashMap<String,String> libOptions)
public abstract LinkedHashMap<String,String> getDefaultLibOptions()
public abstract String getAllowedLibOptionFlags()
public void parseParameters(String paramstring, LinkedHashMap<String,String> libOptions, String allowedLibOptionFlags) throws MaltChainedException
MaltChainedException
protected int binariesInstance(String line, FeatureList featureList) throws MaltChainedException
MaltChainedException
protected void binariesInstances2SVMFileFormat(InputStreamReader isr, OutputStreamWriter osw) throws MaltChainedException
MaltChainedException
protected void saveFeatureMap(OutputStream os, FeatureMap map) throws MaltChainedException
MaltChainedException
protected FeatureMap loadFeatureMap(InputStream is) throws MaltChainedException
MaltChainedException
Copyright 2007-2017 Johan Hall, Jens Nilsson and Joakim Nivre.