Struct crfsuite::Trainer
[−]
[src]
pub struct Trainer { /* fields omitted */ }
The trainer It maintains a data set for training, and provides an interface to various graphical models and training algorithms.
Methods
impl Trainer
[src]
fn new() -> Self
[src]
Construct a trainer
fn clear(&mut self) -> Result<()>
[src]
Remove all instances in the data set
fn append<T: AsRef<str>>(
&mut self,
xseq: &[Item],
yseq: &[T],
group: i32
) -> Result<()>
[src]
&mut self,
xseq: &[Item],
yseq: &[T],
group: i32
) -> Result<()>
Append an instance (item/label sequence) to the data set.
Parameters
xseq
: a sequence of item features, The item sequence of the instance.
yseq
: a sequence of strings, The label sequence of the instance.
group
: The group number of the instance. Group numbers are used to select subset of data
for heldout evaluation.
fn select(&mut self, algorithm: &Algorithm, typ: &GraphicalModel) -> Result<()>
[src]
Initialize the training algorithm.
fn train(&mut self, model: &str, holdout: i32) -> Result<()>
[src]
Run the training algorithm.
This function starts the training algorithm with the data set given
by append()
function.
Parameters
model
: The filename to which the trained model is stored
holdout
: The group number of holdout evaluation.
the instances with this group number will not be used
for training, but for holdout evaluation.
-1 meaning "use all instances for training".
fn params(&self) -> Vec<String>
[src]
Obtain the list of parameters.
This function returns the list of parameter names available for the
graphical model and training algorithm specified by select()
function.
fn set(&mut self, name: &str, value: &str) -> Result<()>
[src]
Set a training parameter.
This function sets a parameter value for the graphical model and
training algorithm specified by select()
function.
fn get(&self, name: &str) -> Result<String>
[src]
Get the value of a training parameter.
This function gets a parameter value for the graphical model and
training algorithm specified by select()
function.
fn help(&self, name: &str) -> Result<String>
[src]
Get the description of a training parameter.
This function obtains the help message for the parameter specified
by the name. The graphical model and training algorithm must be
selected by select()
function before calling this function.