AbstractTrainer (Apache OpenNLP :: Core :: ML :: Commons 3.0.0-M4 API)
Description: declaration: package: opennlp.tools.ml, class: AbstractTrainer

Package opennlp.tools.ml

# Class AbstractTrainer<P extends opennlp.tools.util.Parameters>

java.lang.Object
opennlp.tools.ml.AbstractTrainer<P>

All Implemented Interfaces:
  `opennlp.tools.commons.Trainer<P>`

Direct Known Subclasses:
  `AbstractEventModelSequenceTrainer`, `AbstractEventTrainer`

public abstract class AbstractTrainer<P extends opennlp.tools.util.Parameters> extends Object implements opennlp.tools.commons.Trainer<P>

- ## Constructor Summary

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

- ## Method Summary

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

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

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

- ## Constructor Details

  - ### AbstractTrainer

    public AbstractTrainer()

  - ### AbstractTrainer

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

- ## Method Details

  - ### init

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

  - ### init

    public void init(P trainParams, Map<String,String> reportMap, opennlp.tools.util.TrainingConfiguration config)
    Specified by:
      `init` in interface `opennlp.tools.commons.Trainer<P extends opennlp.tools.util.Parameters>`

  - ### getAlgorithm

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

  - ### getCutoff

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

  - ### getIterations

    public int getIterations()
    Returns:
      Retrieves the configured `Parameters.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 opennlp.tools.util.TrainingConfiguration getTrainingConfiguration()
    Retrieves the `TrainingConfiguration` associated with an `AbstractTrainer`.
    Returns:
      `TrainingConfiguration`