Skip to content

Commit 97fb669

Browse files
committed
add serde support for XGBoostRegressor
1 parent 70212c7 commit 97fb669

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/xgboost/xgb_regressor.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ impl Objective {
122122
/// This is a recursive data structure where each `TreeRegressor` is a node
123123
/// that can have a left and a right child, also of type `TreeRegressor`.
124124
#[allow(dead_code)]
125+
#[derive(Debug)]
125126
struct TreeRegressor<TX: Number + PartialOrd, TY: Number, X: Array2<TX>, Y: Array1<TY>> {
126127
left: Option<Box<TreeRegressor<TX, TY, X, Y>>>,
127128
right: Option<Box<TreeRegressor<TX, TY, X, Y>>>,
@@ -374,6 +375,7 @@ impl<TX: Number + PartialOrd, TY: Number, X: Array2<TX>, Y: Array1<TY>>
374375
/// Parameters for the `jRegressor` model.
375376
///
376377
/// This struct holds all the hyperparameters that control the training process.
378+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
377379
#[derive(Clone, Debug)]
378380
pub struct XGRegressorParameters {
379381
/// The number of boosting rounds or trees to build.
@@ -494,6 +496,8 @@ impl XGRegressorParameters {
494496
}
495497

496498
/// An Extreme Gradient Boosting (XGBoost) model for regression and classification tasks.
499+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
500+
#[derive(Debug)]
497501
pub struct XGRegressor<TX: Number + PartialOrd, TY: Number, X: Array2<TX>, Y: Array1<TY>> {
498502
regressors: Option<Vec<TreeRegressor<TX, TY, X, Y>>>,
499503
parameters: Option<XGRegressorParameters>,

0 commit comments

Comments
 (0)