Tanl Linguistic Pipeline |
Public Member Functions | |
LBFGS (EventStream &es, int iterations, int cutoff=0, double eps=1E-05) | |
Create and train a model from events from a single EventStream. | |
LBFGS (int iterations=50, int cutoff=0, double eps=1E-05) | |
The EventStream is supplied separately with method read(). | |
void | train () |
Train a model on events read with previous calls to read(). | |
void | train (EventStream &es) |
Train a model on events read from. | |
void | save (char const *path) |
Save the model to file. | |
void | writeHeader (std::ofstream &ofs) |
void | writeData (std::ofstream &ofs) |
Protected Attributes | |
double * | lambda |
the model parameters |
Tanl::Classifier::LBFGS::LBFGS | ( | EventStream & | es, | |
int | iterations, | |||
int | cutoff = 0 , |
|||
double | eps = 1E-05 | |||
) |
Create and train a model from events from a single EventStream.
es | the EventStream from which to read training events | |
iterations | max number of iterations to perform | |
cutoff | discard predicates that do not occur at least this many times in the training set | |
eps | determines the terminating accuracy |
References train().
Tanl::Classifier::LBFGS::LBFGS | ( | int | iterations = 50 , |
|
int | cutoff = 0 , |
|||
double | eps = 1E-05 | |||
) |
The EventStream is supplied separately with method read().
This is useful to supply several streams in turn (for instance data from several files).
iterations | max number of iterations to perform | |
cutoff | discard predicates that do not occur at least this many times in the training set | |
eps | determines the terminating accuracy |
void Tanl::Classifier::LBFGS::save | ( | char const * | file | ) |
Save the model to file.
Format for the GIS maxent (.mem) files.
This format can be memory mapped.
1. GIS (model type identifier)
2. the correction constant (int)
3. the correction parameter (double)
4. # of outcomes (int)
5. # of predicates (int)
6. parameters
Example of 5. and 6.: 7(# preds) Sunny(first pred. name) Happy Dry Humid Sad Cloudy Rainy 3(# groups) 1 1(group 1: 1 predicate, 1 outcome) 0(outcome 0) 2.4005893(param[0, 0]) 5 2(group 2: 5 predicates, 2 outcomes) 0(outcome 0) 2.1392054(param[1, 0]) -0.3270814(param[2, 0]) 0.2927261(param[3, 0]) -1.9319866(param[4, 0]) 1.1981091(param[5, 0]) 1(outcome 1) -4.7484765(param[1, 1]) 0.3342510(param[2, 1]) -0.3882752(param[3, 1]) 2.0065205(param[4, 1]) -2.1725304(param[5, 1]) 1 1(group 3: 1 predicate, 1 outcome) 1(outcome 1) 3.5907883(param[6, 1])
Reimplemented from Tanl::Classifier::MaxEnt.
void Tanl::Classifier::LBFGS::train | ( | EventStream & | es | ) |
Train a model on events read from.
es. |
References Tanl::Classifier::MaxEnt::read(), and train().