Package opennlp.tools.ml

# 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

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `ALGORITHM_PARAM`
  `static final int`
  `CUTOFF_DEFAULT`
  `static final String`
  `CUTOFF_PARAM`
  `static final int`
  `ITERATIONS_DEFAULT`
  `static final String`
  `ITERATIONS_PARAM`
  `static final String`
  `TRAINER_TYPE_PARAM`

- ## 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()`
  `void`
  `init(TrainingParameters trainParams, Map<String,String> reportMap)`
  Initializes a `AbstractTrainer` via `TrainingParameters` and a `report map`.
  `void`
  `validate()`
  Checks the configured `parameters`.

  ### Methods inherited from class java.lang.Object

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

- ## Field Details

  - ### ALGORITHM_PARAM

    public static final String ALGORITHM_PARAM
    See Also:
      - Constant Field Values

  - ### TRAINER_TYPE_PARAM

    public static final String TRAINER_TYPE_PARAM
    See Also:
      - Constant Field Values

  - ### CUTOFF_PARAM

    public static final String CUTOFF_PARAM
    See Also:
      - Constant Field Values

  - ### CUTOFF_DEFAULT

    public static final int CUTOFF_DEFAULT
    See Also:
      - Constant Field Values

  - ### ITERATIONS_PARAM

    public static final String ITERATIONS_PARAM
    See Also:
      - Constant Field Values

  - ### ITERATIONS_DEFAULT

    public static final int ITERATIONS_DEFAULT
    See Also:
      - Constant Field Values

- ## 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.

  - ### getAlgorithm

    public String getAlgorithm()
    Returns:
      Retrieves the configured `ALGORITHM_PARAM` value.

  - ### getCutoff

    public int getCutoff()
    Returns:
      Retrieves the configured `CUTOFF_PARAM` value.

  - ### getIterations

    public int getIterations()
    Returns:
      Retrieves the configured `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.