Struct gbdt::input::InputFormat
source · [−]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,
}
Expand description
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.
Implementations
sourceimpl InputFormat
impl InputFormat
sourcepub fn csv_format() -> InputFormat
pub fn csv_format() -> InputFormat
Return a default CSV input format.
Example
use gbdt::input::InputFormat;
let mut fmt = InputFormat::csv_format();
println!("{}", fmt.to_string());
sourcepub fn txt_format() -> InputFormat
pub fn txt_format() -> InputFormat
Return a default LibSVM input format.
Example
use gbdt::input::InputFormat;
let mut fmt = InputFormat::txt_format();
println!("{}", fmt.to_string());
sourcepub fn to_string(&self) -> String
pub fn to_string(&self) -> String
Transform the input format to human readable string.
Example
use gbdt::input::InputFormat;
let mut fmt = InputFormat::csv_format();
println!("{}", fmt.to_string());
sourcepub fn set_feature_size(&mut self, size: usize)
pub fn set_feature_size(&mut self, size: usize)
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
sourcepub fn set_label_index(&mut self, idx: usize)
pub fn set_label_index(&mut self, idx: usize)
Set for label index for CSV format.
Example
use gbdt::input::InputFormat;
let mut fmt = InputFormat::csv_format();
fmt.set_label_index(34);
sourcepub fn set_delimeter(&mut self, delim: char)
pub fn set_delimeter(&mut self, delim: char)
Set for label index for CSV format.
Example
use gbdt::input::InputFormat;
let mut fmt = InputFormat::txt_format();
fmt.set_delimeter(' ');
Trait Implementations
sourceimpl Clone for InputFormat
impl Clone for InputFormat
sourcefn clone(&self) -> InputFormat
fn clone(&self) -> InputFormat
Returns a copy of the value. Read more
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for InputFormat
impl Debug for InputFormat
sourceimpl<'de> Deserialize<'de> for InputFormat
impl<'de> Deserialize<'de> for InputFormat
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Serialize for InputFormat
impl Serialize for InputFormat
impl Copy for InputFormat
Auto Trait Implementations
impl RefUnwindSafe for InputFormat
impl Send for InputFormat
impl Sync for InputFormat
impl Unpin for InputFormat
impl UnwindSafe for InputFormat
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more