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 String` | `ALGORITHM_PARAM` |
    `static int` | `CUTOFF_DEFAULT` |
    `static String` | `CUTOFF_PARAM` |
    `static int` | `ITERATIONS_DEFAULT` |
    `static String` | `ITERATIONS_PARAM` |
    `static String` | `TRAINER_TYPE_PARAM` |

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `String` | `getAlgorithm()` |
    `int` | `getCutoff()` |
    `int` | `getIterations()` |
    `void` | `init​(Map<String,​Object> trainParams, Map<String,​String> reportMap)` | Deprecated. Use `init(TrainingParameters, Map)` instead.
    `void` | `init​(TrainingParameters trainParams, Map<String,​String> reportMap)` | Initializes a `AbstractTrainer` via `TrainingParameters` and a `report map`.
    `boolean` | `isValid()` | Deprecated. Use `validate()` instead.
    `void` | `validate()` | Checks the configured `parameters`.

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

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

- - ### Field Detail

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

    - #### AbstractTrainer

          public AbstractTrainer()

    - #### AbstractTrainer

          public AbstractTrainer​(TrainingParameters trainParams)

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

  - ### Method Detail

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

          @Deprecated
          public void init​(Map<String,​Object> trainParams,
                           Map<String,​String> reportMap)

      Deprecated.
      Use `init(TrainingParameters, Map)` instead.
      Initializes a `AbstractTrainer` via `TrainingParameters` and a `report map`.
      Parameters:
        `trainParams` - The `Map` that maps training parameters on a key-value basis.
        `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.

    - #### isValid

          @Deprecated
          public boolean isValid()

      Deprecated.
      Use `validate()` instead.
      Returns:
        `true` if the validation of the internal configuration succeeds, `false` otherwise.