Package opennlp.tools.ml
Class AbstractTrainer
java.lang.Object
opennlp.tools.ml.AbstractTrainer
- All Implemented Interfaces:
Trainer
- Direct Known Subclasses:
AbstractEventModelSequenceTrainer
,AbstractEventTrainer
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractTrainer
(TrainingParameters trainParams) Initializes aAbstractTrainer
viaTrainingParameters
. -
Method Summary
Modifier and TypeMethodDescriptionint
int
Retrieves theTrainingConfiguration
associated with anAbstractTrainer
.void
init
(TrainingParameters trainParams, Map<String, String> reportMap) void
init
(TrainingParameters trainParams, Map<String, String> reportMap, TrainingConfiguration config) Conducts the initialization of aTrainer
viaTrainingParameters
,report map
andTrainingConfiguration
void
validate()
Checks the configuredparameters
.
-
Constructor Details
-
AbstractTrainer
public AbstractTrainer() -
AbstractTrainer
Initializes aAbstractTrainer
viaTrainingParameters
.- Parameters:
trainParams
- TheTrainingParameters
to use.
-
-
Method Details
-
init
- Specified by:
init
in interfaceTrainer
- Parameters:
trainParams
- TheTrainingParameters
to use.reportMap
- TheMap
instance used as report map.
-
init
public void init(TrainingParameters trainParams, Map<String, String> reportMap, TrainingConfiguration config) Conducts the initialization of aTrainer
viaTrainingParameters
,report map
andTrainingConfiguration
- Specified by:
init
in interfaceTrainer
- Parameters:
trainParams
- TheTrainingParameters
to use.reportMap
- TheMap
instance used as report map.config
- TheTrainingConfiguration
to use. If null, suitable defaults will be used.
-
getAlgorithm
- Returns:
- Retrieves the configured
TrainingParameters.ALGORITHM_PARAM
value.
-
getCutoff
public int getCutoff()- Returns:
- Retrieves the configured
TrainingParameters.CUTOFF_PARAM
value.
-
getIterations
public int getIterations()- Returns:
- Retrieves the configured
TrainingParameters.ITERATIONS_PARAM
value.
-
validate
public void validate()Checks the configuredparameters
. If a subclass overrides this, it should callsuper.validate();
.- Throws:
IllegalArgumentException
- Thrown if default training parameters are invalid.
-
getTrainingConfiguration
Retrieves theTrainingConfiguration
associated with anAbstractTrainer
.- Returns:
TrainingConfiguration
-