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]
impl Trainer
pub fn new(verbose: bool) -> Self
[src]
pub fn new(verbose: bool) -> Self
Construct a trainer
pub fn clear(&mut self) -> Result<()>
[src]
pub fn clear(&mut self) -> Result<()>
Remove all instances in the data set
pub fn append<T: AsRef<str>>(
&mut self,
xseq: &[Item],
yseq: &[T],
group: i32
) -> Result<()>
[src]
pub fn append<T: AsRef<str>>(
&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.
pub fn select(
&mut self,
algorithm: Algorithm,
typ: GraphicalModel
) -> Result<()>
[src]
pub fn select(
&mut self,
algorithm: Algorithm,
typ: GraphicalModel
) -> Result<()>
Initialize the training algorithm.
pub fn train(&mut self, model: &str, holdout: i32) -> Result<()>
[src]
pub fn train(&mut self, model: &str, holdout: i32) -> Result<()>
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".
pub fn params(&self) -> Vec<String>
[src]
pub fn params(&self) -> Vec<String>
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.
pub fn set(&mut self, name: &str, value: &str) -> Result<()>
[src]
pub fn set(&mut self, name: &str, value: &str) -> Result<()>
Set a training parameter.
This function sets a parameter value for the graphical model and
training algorithm specified by select()
function.
pub fn get(&self, name: &str) -> Result<String>
[src]
pub fn get(&self, name: &str) -> Result<String>
Get the value of a training parameter.
This function gets a parameter value for the graphical model and
training algorithm specified by select()
function.
pub fn help(&self, name: &str) -> Result<String>
[src]
pub fn help(&self, name: &str) -> Result<String>
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.
Trait Implementations
impl Debug for Trainer
[src]
impl Debug for Trainer
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Default for Trainer
[src]
impl Default for Trainer
impl Drop for Trainer
[src]
impl Drop for Trainer