pub struct FittedGradientBoostingClassifier<F> { /* private fields */ }Expand description
A fitted gradient boosting classifier.
For binary classification, stores a single sequence of trees predicting log-odds.
For multiclass, stores K sequences of trees (one per class).
Implementations§
Source§impl<F: Float + Send + Sync + 'static> FittedGradientBoostingClassifier<F>
impl<F: Float + Send + Sync + 'static> FittedGradientBoostingClassifier<F>
Sourcepub fn learning_rate(&self) -> F
pub fn learning_rate(&self) -> F
Returns the learning rate used during training.
Sourcepub fn trees(&self) -> &[Vec<Vec<Node<F>>>]
pub fn trees(&self) -> &[Vec<Vec<Node<F>>>]
Returns a reference to the tree ensemble.
For binary classification, trees()[0] contains all trees.
For multiclass, trees()[k] contains trees for class k.
Sourcepub fn n_features(&self) -> usize
pub fn n_features(&self) -> usize
Returns the number of features the model was trained on.
Sourcepub fn score(&self, x: &Array2<F>, y: &Array1<usize>) -> Result<F, FerroError>
pub fn score(&self, x: &Array2<F>, y: &Array1<usize>) -> Result<F, FerroError>
Mean accuracy on the given test data and labels.
Equivalent to sklearn’s ClassifierMixin.score.
§Errors
Returns FerroError::ShapeMismatch if x.nrows() != y.len() or
the feature count does not match the training data.
Sourcepub fn predict_proba(&self, x: &Array2<F>) -> Result<Array2<F>, FerroError>
pub fn predict_proba(&self, x: &Array2<F>) -> Result<Array2<F>, FerroError>
Predict class probabilities. Mirrors sklearn’s
GradientBoostingClassifier.predict_proba.
Binary: applies the logistic link to the cumulative log-odds. Multiclass: softmax over K cumulative scores.
Returns shape (n_samples, n_classes); rows sum to 1.
§Errors
Returns FerroError::ShapeMismatch if the number of features
does not match the fitted model.
Sourcepub fn predict_log_proba(&self, x: &Array2<F>) -> Result<Array2<F>, FerroError>
pub fn predict_log_proba(&self, x: &Array2<F>) -> Result<Array2<F>, FerroError>
Element-wise log of predict_proba. Mirrors
sklearn’s ClassifierMixin.predict_log_proba.
§Errors
Forwards any error from predict_proba.
Sourcepub fn decision_function(&self, x: &Array2<F>) -> Result<Array2<F>, FerroError>
pub fn decision_function(&self, x: &Array2<F>) -> Result<Array2<F>, FerroError>
Cumulative raw scores per sample (pre-link). Mirrors sklearn’s
GradientBoostingClassifier.decision_function.
Binary: shape (n_samples, 1) containing the cumulative log-odds.
Multiclass: shape (n_samples, n_classes) containing per-class
cumulative scores. (sklearn returns shape (n_samples,) for the
binary case; ferrolearn keeps a 2-D shape for type-uniformity.)
§Errors
Returns FerroError::ShapeMismatch if the number of features
does not match the fitted model.
Trait Implementations§
Source§impl<F: Clone> Clone for FittedGradientBoostingClassifier<F>
impl<F: Clone> Clone for FittedGradientBoostingClassifier<F>
Source§fn clone(&self) -> FittedGradientBoostingClassifier<F>
fn clone(&self) -> FittedGradientBoostingClassifier<F>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<F: Debug> Debug for FittedGradientBoostingClassifier<F>
impl<F: Debug> Debug for FittedGradientBoostingClassifier<F>
Source§impl<F: Float + Send + Sync + 'static> HasClasses for FittedGradientBoostingClassifier<F>
impl<F: Float + Send + Sync + 'static> HasClasses for FittedGradientBoostingClassifier<F>
Source§impl<F: Float + Send + Sync + 'static> HasFeatureImportances<F> for FittedGradientBoostingClassifier<F>
impl<F: Float + Send + Sync + 'static> HasFeatureImportances<F> for FittedGradientBoostingClassifier<F>
Source§fn feature_importances(&self) -> &Array1<F>
fn feature_importances(&self) -> &Array1<F>
Source§impl<F: Float + Send + Sync + 'static> Predict<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>> for FittedGradientBoostingClassifier<F>
impl<F: Float + Send + Sync + 'static> Predict<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>> for FittedGradientBoostingClassifier<F>
Source§fn predict(&self, x: &Array2<F>) -> Result<Array1<usize>, FerroError>
fn predict(&self, x: &Array2<F>) -> Result<Array1<usize>, FerroError>
Predict class labels.
§Errors
Returns FerroError::ShapeMismatch if the number of features does
not match the fitted model.
Source§type Output = ArrayBase<OwnedRepr<usize>, Dim<[usize; 1]>>
type Output = ArrayBase<OwnedRepr<usize>, Dim<[usize; 1]>>
ndarray::Array1<F> or ndarray::Array1<usize>).Source§type Error = FerroError
type Error = FerroError
predict.Auto Trait Implementations§
impl<F> Freeze for FittedGradientBoostingClassifier<F>where
F: Freeze,
impl<F> RefUnwindSafe for FittedGradientBoostingClassifier<F>where
F: RefUnwindSafe,
impl<F> Send for FittedGradientBoostingClassifier<F>where
F: Send,
impl<F> Sync for FittedGradientBoostingClassifier<F>where
F: Sync,
impl<F> Unpin for FittedGradientBoostingClassifier<F>where
F: Unpin,
impl<F> UnsafeUnpin for FittedGradientBoostingClassifier<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for FittedGradientBoostingClassifier<F>where
F: UnwindSafe + RefUnwindSafe,
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> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
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