[−][src]Struct gbdt::decision_tree::Data
A training sample or a test sample. You can call new_training_data
to generate a training sample, and call new_test_data
to generate a test sample.
A training sample can be used as a test sample.
You can also directly generate a data with following guides:
-
When using the gbdt algorithm for training, you should set the values of feature, weight and label. If Config::initial_guess_enabled is true, you should set the value of initial_guess as well. Other fields can be arbitrary value.
-
When using the gbdt algorithm for inference, you should set the value of feature. Other fields can be arbitrary value.
-
When directly using the decision tree for training, only "SquaredError" is supported and you should set the values of feature, weight, label and target.
label
andtarget
are equal. Other fields can be arbitrary value. -
When directly using the decision tree for inference, only "SquaredError" is supported and you should set the values of feature.
Fields
feature: Vec<ValueType>
the vector of features
target: ValueType
the target value of the sample to be fit in one decistion tree. This value is calculated by gradient boost algorithm. If you want to use the decision tree with "SquaredError" directly, set this value with label
value
weight: ValueType
sample's weight. Used in training.
label: ValueType
sample's label. Used in training. This value is the actual value of the training sample.
residual: ValueType
used by LAD loss. Calculated by gradient boost algorithm.
initial_guess: ValueType
used by gradient boost. Set this value if Config::initial_guess_enabled is true.
Methods
impl Data
[src]
pub fn new_training_data(
feature: Vec<ValueType>,
weight: ValueType,
label: ValueType,
initial_guess: Option<ValueType>
) -> Self
[src]
feature: Vec<ValueType>,
weight: ValueType,
label: ValueType,
initial_guess: Option<ValueType>
) -> Self
Generate a training sample.
feature: the vector of features
weight: sample's weight
label: sample's label
initial_guess: initial prediction for the sample. This value is optional. Set this value if Config::initial_guess_enabled is true.
Example
use gbdt::decision_tree::Data; let data1 = Data::new_training_data(vec![1.0, 2.0, 3.0], 1.0, 2.0, Some(0.5)); let data2 = Data::new_training_data(vec![1.0, 2.0, 3.0], 1.0, 2.0, None);
pub fn new_test_data(feature: Vec<ValueType>, label: Option<ValueType>) -> Self
[src]
Generate a test sample.
label: sample's label. It's optional.
Example
use gbdt::decision_tree::Data; let data1 = Data::new_test_data(vec![1.0, 2.0, 3.0], Some(0.5)); let data2 = Data::new_test_data(vec![1.0, 2.0, 3.0], None);
Trait Implementations
impl Clone for Data
[src]
fn clone(&self) -> Data
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Data
[src]
impl Serialize for Data
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de> Deserialize<'de> for Data
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,