AbstractTrainer (Apache OpenNLP Tools 2.5.9 API)
Description: declaration: package: opennlp.tools.ml, class: AbstractTrainer

# Class AbstractTrainer

java.lang.Object
opennlp.tools.ml.AbstractTrainer

All Implemented Interfaces:
  `Trainer`

Direct Known Subclasses:
  `AbstractEventModelSequenceTrainer, AbstractEventTrainer`

public abstract class AbstractTrainer extends Object implements Trainer

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AbstractTrainer()`
  `AbstractTrainer(TrainingParameters trainParams)`
  Initializes a `AbstractTrainer` via `TrainingParameters`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getAlgorithm()`
  `int`
  `getCutoff()`
  `int`
  `getIterations()`
  `TrainingConfiguration`
  `getTrainingConfiguration()`
  Retrieves the `TrainingConfiguration` associated with an `AbstractTrainer`.
  `void`
  `init(TrainingParameters trainParams, Map<String,String> reportMap)`
  Initializes a `AbstractTrainer` via `TrainingParameters` and a `report map`.
  `void`
  `init(TrainingParameters trainParams, Map<String,String> reportMap, TrainingConfiguration config)`
  Conducts the initialization of a `Trainer` via `TrainingParameters`, `report map` and `TrainingConfiguration`
  `void`
  `validate()`
  Checks the configured `parameters`.

  ### Methods inherited from class Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### AbstractTrainer

    public AbstractTrainer()

  - ### AbstractTrainer

    public AbstractTrainer(TrainingParameters trainParams)
    Initializes a `AbstractTrainer` via `TrainingParameters`.
    Parameters:
      `trainParams` - The `TrainingParameters` to use.

- ## Method Details

  - ### init

    public void init(TrainingParameters trainParams, Map<String,String> reportMap)
    Initializes a `AbstractTrainer` via `TrainingParameters` and a `report map`.
    Specified by:
      `init` in interface `Trainer`
    Parameters:
      `trainParams` - The `TrainingParameters` to use.
      `reportMap` - The `Map` instance used as report map.

  - ### init

    public void init(TrainingParameters trainParams, Map<String,String> reportMap, TrainingConfiguration config)
    Conducts the initialization of a `Trainer` via `TrainingParameters`, `report map` and `TrainingConfiguration`
    Specified by:
      `init` in interface `Trainer`
    Parameters:
      `trainParams` - The `TrainingParameters` to use.
      `reportMap` - The `Map` instance used as report map.
      `config` - The `TrainingConfiguration` to use. If null, suitable defaults will be used.

  - ### getAlgorithm

    public String 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 configured `parameters`. If a subclass overrides this, it should call `super.validate();`.
    Throws:
      `IllegalArgumentException` - Thrown if default training parameters are invalid.

  - ### getTrainingConfiguration

    public TrainingConfiguration getTrainingConfiguration()
    Retrieves the `TrainingConfiguration` associated with an `AbstractTrainer`.
    Returns:
      `TrainingConfiguration`