Class AbstractTrainer

Namespace
NOpenNLP.Tools.Ml
Assembly
NOpenNLP.Tools.dll

Base class for trainers, holding the training parameters and the report map.

public abstract class AbstractTrainer
Inheritance
AbstractTrainer
Derived
Inherited Members

Constructors

AbstractTrainer()

protected AbstractTrainer()

AbstractTrainer(TrainingParameters)

protected AbstractTrainer(TrainingParameters parameters)

Parameters

parameters TrainingParameters

Fields

ALGORITHM_PARAM

public const string ALGORITHM_PARAM = "Algorithm"

Field Value

string

CUTOFF_DEFAULT

public const int CUTOFF_DEFAULT = 5

Field Value

int

CUTOFF_PARAM

public const string CUTOFF_PARAM = "Cutoff"

Field Value

string

ITERATIONS_DEFAULT

public const int ITERATIONS_DEFAULT = 100

Field Value

int

ITERATIONS_PARAM

public const string ITERATIONS_PARAM = "Iterations"

Field Value

string

TRAINER_TYPE_PARAM

public const string TRAINER_TYPE_PARAM = "TrainerType"

Field Value

string

VERBOSE_DEFAULT

public const bool VERBOSE_DEFAULT = true

Field Value

bool

VERBOSE_PARAM

public const string VERBOSE_PARAM = "PrintMessages"

Field Value

string

printMessages

protected bool printMessages

Field Value

bool

reportMap

protected IDictionary<string, string> reportMap

Field Value

IDictionary<string, string>

trainingParameters

protected TrainingParameters trainingParameters

Field Value

TrainingParameters

Properties

Algorithm

Gets the configured algorithm name, defaulting to maxent.

public virtual string Algorithm { get; }

Property Value

string

Cutoff

Gets the configured cutoff.

public virtual int Cutoff { get; }

Property Value

int

Iterations

Gets the configured number of iterations.

public virtual int Iterations { get; }

Property Value

int

Methods

AddToReport(string, string)

Adds the key/value pair to the report map.

protected virtual void AddToReport(string key, string value)

Parameters

key string
value string

Display(string)

protected virtual void Display(string s)

Parameters

s string

Init(TrainingParameters, IDictionary<string, string>?)

Initializes this trainer with the given parameters and report map.

public virtual void Init(TrainingParameters trainingParameters, IDictionary<string, string>? reportMap)

Parameters

trainingParameters TrainingParameters
reportMap IDictionary<string, string>

Validate()

Checks the parameters. If a subclass overrides this, it should call the base implementation.

public virtual void Validate()

Exceptions

ArgumentException

Thrown if a parameter is not valid.