Struct fann::TrainData [] [src]

pub struct TrainData {
    // some fields omitted
}

Methods

impl TrainData

fn from_file<P: AsRef<Path>>(path: P) -> FannResult<TrainData>

Read a file that stores training data.

The file must be formatted like:

num_train_data num_input num_output
inputdata separated by space
outputdata separated by space
.
.
.
inputdata separated by space
outputdata separated by space

fn from_callback(num_data: c_uint, num_input: c_uint, num_output: c_uint, cb: Box<TrainCallback>) -> FannResult<TrainData>

Create training data using the given callback which for each number between 0 (included) and num_data (excluded) returns a pair of input and output vectors with num_input and num_output entries respectively.

fn save<P: AsRef<Path>>(&self, path: P) -> FannResult<()>

Save the training data to a file.

fn merge(data1: &TrainData, data2: &TrainData) -> FannResult<TrainData>

Merge the given data sets into a new one.

fn subset(&self, pos: c_uint, length: c_uint) -> FannResult<TrainData>

Create a subset of the training data, starting at the given positon and consisting of length samples.

fn length(&self) -> c_uint

Return the number of training patterns in the data.

fn num_input(&self) -> c_uint

Return the number of input values in each training pattern.

fn num_output(&self) -> c_uint

Return the number of output values in each training pattern.

fn scale_for(&mut self, fann: &Fann) -> FannResult<()>

Scale input and output in the training data using the parameters previously calculated for the given network.

fn descale_for(&mut self, fann: &Fann) -> FannResult<()>

Descale input and output in the training data using the parameters previously calculated for the given network.

fn scale_input(&mut self, new_min: fann_type, new_max: fann_type) -> FannResult<()>

Scales the inputs in the training data to the specified range.

fn scale_output(&mut self, new_min: fann_type, new_max: fann_type) -> FannResult<()>

Scales the outputs in the training data to the specified range.

fn scale(&mut self, new_min: fann_type, new_max: fann_type) -> FannResult<()>

Scales the inputs and outputs in the training data to the specified range.

fn shuffle(&mut self)

Shuffle training data, randomizing the order. This is recommended for incremental training while it does not affect batch training.

unsafe fn get_raw(&self) -> *mut fann_train_data

Get a pointer to the underlying raw fann_train_data structure.

Trait Implementations

impl Clone for TrainData

fn clone(&self) -> TrainData

fn clone_from(&mut self, source: &Self)

impl Drop for TrainData

fn drop(&mut self)