Skip to content

XGBoost

flowcean.xgboost provides boosted classification and regression learners and models. Install the xgboost extra as described in installation.

xgboost

Classes

XGBoostClassifierLearner

XGBoostClassifierLearner(threshold: float = 0.5, callbacks: list[LearnerCallback] | LearnerCallback | None = None, **kwargs: Any)

Bases: SupervisedLearner

Wrapper for XGBoost classifiers.

Parameters:

Name Type Description Default
threshold float

Decision threshold for binary classification (default: 0.5).

0.5
callbacks list[LearnerCallback] | LearnerCallback | None

Optional callbacks for progress feedback. Use None for silent learning.

None
**kwargs Any

Arguments passed to XGBClassifier (n_estimators, max_depth, etc.)

{}
Attributes
threshold instance-attribute
threshold = threshold
classifier instance-attribute
classifier = XGBClassifier(**kwargs)
callback_manager instance-attribute
callback_manager = create_callback_manager(callbacks)
Methods:
learn
learn(inputs: LazyFrame, outputs: LazyFrame) -> XGBoostClassifierModel

XGBoostRegressorLearner

XGBoostRegressorLearner(callbacks: list[LearnerCallback] | LearnerCallback | None = None, **kwargs: Any)

Bases: SupervisedLearner

Wrapper for XGBoost regressor.

Parameters:

Name Type Description Default
callbacks list[LearnerCallback] | LearnerCallback | None

Optional callbacks for progress feedback. Use None for silent learning.

None
**kwargs Any

Arguments passed to XGBRegressor (n_estimators, max_depth, etc.)

{}
Attributes
regressor instance-attribute
regressor = XGBRegressor(**kwargs)
callback_manager instance-attribute
callback_manager = create_callback_manager(callbacks)
Methods:
learn
learn(inputs: LazyFrame, outputs: LazyFrame) -> XGBoostRegressorModel

XGBoostClassifierModel

XGBoostClassifierModel(classifier: XGBClassifier, *, input_features: list[str], output_features: list[str], threshold: float = 0.5)

Bases: Model

Wrapper for an XGBoost classifier model with threshold support.

Attributes
classifier instance-attribute
classifier: XGBClassifier = classifier
input_features instance-attribute
input_features: list[str] = input_features
output_features instance-attribute
output_features: list[str] = output_features
threshold instance-attribute
threshold = threshold
pre_transform instance-attribute
pre_transform = Identity()
post_transform instance-attribute
post_transform = Identity()
Methods:
predict_proba
predict_proba(input_features: LazyFrame) -> LazyFrame

Predict class probabilities, applying preprocessing transforms.

Parameters:

Name Type Description Default
input_features LazyFrame

The inputs for which to predict probabilities.

required

Returns:

Type Description
LazyFrame

The predicted probabilities for the positive class.

XGBoostRegressorModel

XGBoostRegressorModel(regressor: XGBRegressor, *, input_features: list[str], output_features: list[str])

Bases: Model

Wrapper for an XGBoost regressor model.

Attributes
regressor instance-attribute
regressor: XGBRegressor = regressor
input_features instance-attribute
input_features: list[str] = input_features
output_features instance-attribute
output_features: list[str] = output_features

Functions: