pub struct GradientBoostedTree {
pub schema_version: u32,
pub trees: Vec<TreeNode>,
pub base_score: f64,
pub learning_rate: f64,
pub feature_names: Vec<String>,
pub quantile: Option<f64>,
pub output_scale: f64,
pub metadata: Option<Value>,
}Expand description
A gradient-boosted tree ensemble model.
Predictions are computed as: base_score + learning_rate * sum(tree_predictions).
Models are JSON-serializable with schema versioning for forward compatibility.
Fields§
§schema_version: u32Schema version for forward/backward compatibility.
trees: Vec<TreeNode>The ensemble of decision trees.
base_score: f64Initial prediction (bias / intercept).
learning_rate: f64Learning rate (shrinkage factor applied to each tree).
feature_names: Vec<String>Feature names in order matching feature_index.
quantile: Option<f64>Target quantile: None for L2/mean, Some(q) for quantile regression.
output_scale: f64Output scale factor applied to the final prediction.
metadata: Option<Value>Optional metadata about the model.
Implementations§
Source§impl GradientBoostedTree
impl GradientBoostedTree
Sourcepub fn predict_batch(&self, feature_matrix: &[Vec<f64>]) -> Vec<f64>
pub fn predict_batch(&self, feature_matrix: &[Vec<f64>]) -> Vec<f64>
Predict a batch of samples.
Sourcepub fn n_features(&self) -> usize
pub fn n_features(&self) -> usize
Number of features the model expects.
Sourcepub fn feature_importance(&self) -> HashMap<usize, f64>
pub fn feature_importance(&self) -> HashMap<usize, f64>
Compute feature importance based on split frequency. Returns a map from feature index to normalized importance [0, 1].
Sourcepub fn feature_importance_named(&self) -> HashMap<String, f64>
pub fn feature_importance_named(&self) -> HashMap<String, f64>
Compute named feature importance.
Sourcepub fn from_bytes(data: &[u8]) -> Result<Self>
pub fn from_bytes(data: &[u8]) -> Result<Self>
Deserialize a model from bytes (UTF-8 JSON).
Trait Implementations§
Source§impl Clone for GradientBoostedTree
impl Clone for GradientBoostedTree
Source§fn clone(&self) -> GradientBoostedTree
fn clone(&self) -> GradientBoostedTree
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GradientBoostedTree
impl Debug for GradientBoostedTree
Source§impl<'de> Deserialize<'de> for GradientBoostedTree
impl<'de> Deserialize<'de> for GradientBoostedTree
Source§fn 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>,
Auto Trait Implementations§
impl Freeze for GradientBoostedTree
impl RefUnwindSafe for GradientBoostedTree
impl Send for GradientBoostedTree
impl Sync for GradientBoostedTree
impl Unpin for GradientBoostedTree
impl UnsafeUnpin for GradientBoostedTree
impl UnwindSafe for GradientBoostedTree
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more