Struct fann::TrainData

source ·
pub struct TrainData { /* private fields */ }

Implementations§

source§

impl TrainData

source

pub 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
source

pub fn from_callback( num_data: c_uint, num_input: c_uint, num_output: c_uint, cb: Box<dyn Fn(c_uint) -> (Vec<fann_type>, Vec<fann_type>)> ) -> 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.

source

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

Save the training data to a file.

source

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

Merge the given data sets into a new one.

source

pub 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.

source

pub fn length(&self) -> c_uint

Return the number of training patterns in the data.

source

pub fn num_input(&self) -> c_uint

Return the number of input values in each training pattern.

source

pub fn num_output(&self) -> c_uint

Return the number of output values in each training pattern.

source

pub 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.

source

pub 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.

source

pub 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.

source

pub 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.

source

pub 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.

source

pub fn shuffle(&mut self)

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

source

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

Get a pointer to the underlying raw fann_train_data structure.

Trait Implementations§

source§

impl Clone for TrainData

source§

fn clone(&self) -> TrainData

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Drop for TrainData

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.