[][src]Struct liblinear::util::TrainingInput

pub struct TrainingInput { /* fields omitted */ }

Methods

impl TrainingInput[src]

pub fn len_data(&self) -> usize[src]

Number of training instances.

pub fn len_features(&self) -> usize[src]

Dimensionality of the feature vector.

pub fn get(&self, index: usize) -> Option<&TrainingInstance>[src]

Returns a reference to the training instance at the given index.

pub fn from_libsvm_file(path: &str) -> Result<TrainingInput, TrainingInputError>[src]

Create a new instance from a LIBSVM training data file.

Each line in the data file represents a training instance and has the following format:

<target_value> <feature_index>:<feature_value> <feature_index>:<feature_value>...

Feature indices start from 1 and increase monotonically. However, they do not need to be continuous.

pub fn from_dense_features(
    labels: Vec<f64>,
    features: Vec<Vec<f64>>
) -> Result<TrainingInput, TrainingInputError>
[src]

Create a new instance from a dense vector of features and their corresponding target values.

pub fn from_sparse_features(
    labels: Vec<f64>,
    features: Vec<Vec<(u32, f64)>>
) -> Result<TrainingInput, TrainingInputError>
[src]

Create a new instance from a sparse vector of features and their corresponding target values.

The feature vector must be a list of tuples that encode a feature index and its corresponding feature value.

Trait Implementations

impl Default for TrainingInput[src]

impl Clone for TrainingInput[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.