[][src]Struct gbdt::input::InputFormat

pub struct InputFormat {
    pub ftype: FileFormat,
    pub header: bool,
    pub label_idx: usize,
    pub enable_unknown_value: bool,
    pub delimeter: char,
    pub feature_size: usize,
}

The input file format struct.

Fields

ftype: FileFormat

Data file format

header: bool

Set if ftype is set to FileFormat. Indicates whether the csv has header.

label_idx: usize

Set if ftype is set to FileFormat. Indicates which colume is the data label. (default = 0)

enable_unknown_value: bool

Set if ftype is set to FileFormat. Indicates if we allow unknown value in data file or not.

delimeter: char

Delimeter of the data file.

feature_size: usize

Set if ftype is set to FileFormat. Indicates the total feature size.

Methods

impl InputFormat[src]

pub fn csv_format() -> InputFormat[src]

Return a default CSV input format.

Example

use gbdt::input::InputFormat;
let mut fmt = InputFormat::csv_format();
println!("{}", fmt.to_string());

pub fn txt_format() -> InputFormat[src]

Return a default LibSVM input format.

Example

use gbdt::input::InputFormat;
let mut fmt = InputFormat::txt_format();
println!("{}", fmt.to_string());

pub fn to_string(&self) -> String[src]

Transform the input format to human readable string.

Example

use gbdt::input::InputFormat;
let mut fmt = InputFormat::csv_format();
println!("{}", fmt.to_string());

pub fn set_feature_size(&mut self, size: usize)[src]

Set feature size for the LibSVM input format.

Example

use gbdt::input::InputFormat;
let mut fmt = InputFormat::txt_format();
fmt.set_feature_size(126); // the total feature size

pub fn set_label_index(&mut self, idx: usize)[src]

Set for label index for CSV format.

Example

use gbdt::input::InputFormat;
let mut fmt = InputFormat::csv_format();
fmt.set_label_index(34);

pub fn set_delimeter(&mut self, delim: char)[src]

Set for label index for CSV format.

Example

use gbdt::input::InputFormat;
let mut fmt = InputFormat::txt_format();
fmt.set_delimeter(' ');

Trait Implementations

impl Clone for InputFormat[src]

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

Performs copy-assignment from source. Read more

impl Copy for InputFormat[src]

impl Debug for InputFormat[src]

impl Serialize for InputFormat[src]

impl<'de> Deserialize<'de> for InputFormat[src]

Auto Trait Implementations

impl Send for InputFormat

impl Sync for InputFormat

Blanket Implementations

impl<T> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

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

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

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

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]