Class QNTrainer

Namespace
NOpenNLP.Tools.Ml.Maxent.Quasinewton
Assembly
NOpenNLP.Tools.dll

Maxent model trainer using L-BFGS algorithm.

public class QNTrainer : AbstractEventTrainer, IEventTrainer
Inheritance
QNTrainer
Implements
Inherited Members

Constructors

QNTrainer()

public QNTrainer()

QNTrainer(TrainingParameters)

public QNTrainer(TrainingParameters parameters)

Parameters

parameters TrainingParameters

QNTrainer(bool)

public QNTrainer(bool printMessages)

Parameters

printMessages bool

QNTrainer(int)

public QNTrainer(int m)

Parameters

m int

QNTrainer(int, bool)

public QNTrainer(int m, bool verbose)

Parameters

m int
verbose bool

QNTrainer(int, int, bool)

public QNTrainer(int m, int maxFctEval, bool printMessages)

Parameters

m int
maxFctEval int
printMessages bool

Fields

L1COST_DEFAULT

public const double L1COST_DEFAULT = 0.1

Field Value

double

L1COST_PARAM

public const string L1COST_PARAM = "L1Cost"

Field Value

string

L2COST_DEFAULT

public const double L2COST_DEFAULT = 0.1

Field Value

double

L2COST_PARAM

public const string L2COST_PARAM = "L2Cost"

Field Value

string

MAXENT_QN_VALUE

public const string MAXENT_QN_VALUE = "MAXENT_QN"

Field Value

string

MAX_FCT_EVAL_DEFAULT

public const int MAX_FCT_EVAL_DEFAULT = 30000

Field Value

int

MAX_FCT_EVAL_PARAM

public const string MAX_FCT_EVAL_PARAM = "MaxFctEval"

Field Value

string

M_DEFAULT

public const int M_DEFAULT = 15

Field Value

int

M_PARAM

public const string M_PARAM = "NumOfUpdates"

Field Value

string

THREADS_DEFAULT

public const int THREADS_DEFAULT = 1

Field Value

int

THREADS_PARAM

public const string THREADS_PARAM = "Threads"

Field Value

string

Properties

IsSortAndMerge

Whether the data indexer should sort and merge the indexed events.

public override bool IsSortAndMerge { get; }

Property Value

bool

Methods

DoTrain(IDataIndexer)

Trains a model from the given, already indexed, training data.

public override IMaxentModel DoTrain(IDataIndexer indexer)

Parameters

indexer IDataIndexer

Returns

IMaxentModel

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

Initializes this trainer with the given parameters and report map.

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

Parameters

trainingParameters TrainingParameters
reportMap IDictionary<string, string>

TrainModel(int, IDataIndexer)

public QNModel TrainModel(int iterations, IDataIndexer indexer)

Parameters

iterations int
indexer IDataIndexer

Returns

QNModel

Validate()

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

public override void Validate()

Exceptions

ArgumentException

Thrown if a parameter is not valid.