Skip to content

CatBoost Adapter API

This section documents the CatBoost adapter used to integrate catboost.CatBoostRegressor into the eb-adapters package.

All content below is generated automatically from NumPy-style docstrings in the source code.

CatBoost Adapter Module

eb_adapters.catboost

CatBoostAdapter

Bases: BaseAdapter

Adapter for catboost.CatBoostRegressor.

This adapter exposes a scikit-learn-like API and stores initialization parameters so the instance can be reconstructed by cloning utilities (for example, an internal clone_model() helper or sklearn.base.clone).

Parameters:

Name Type Description Default
**params Any

Keyword arguments forwarded to catboost.CatBoostRegressor.

{}
Notes
  • X and y are treated as standard tabular regression inputs.
  • If provided, sample_weight is passed through to CatBoost training.
  • Training verbosity is disabled by default (verbose=False) unless the caller supplies verbose explicitly.
  • All initialization parameters are stored in self.params.

Examples:

>>> model = CatBoostAdapter(
...     depth=4,
...     learning_rate=0.1,
...     iterations=200,
...     loss_function="RMSE",
... )
>>> # X, y are numpy arrays (or array-like)
>>> # model.fit(X, y).predict(X)

fit(X, y, sample_weight=None)

Fit the underlying catboost.CatBoostRegressor.

Parameters:

Name Type Description Default
X ndarray

Feature matrix of shape (n_samples, n_features).

required
y ndarray

Target vector of shape (n_samples,).

required
sample_weight ndarray | None

Optional per-sample weights of shape (n_samples,). If provided, this is forwarded to CatBoost training.

None

Returns:

Type Description
CatBoostAdapter

The fitted adapter (self), allowing method chaining.

Raises:

Type Description
RuntimeError

If CatBoost is not available or the internal model is not initialized.

predict(X)

Predict using the fitted CatBoost model.

Parameters:

Name Type Description Default
X ndarray

Feature matrix of shape (n_samples, n_features).

required

Returns:

Type Description
ndarray

Predicted values of shape (n_samples,).

Raises:

Type Description
RuntimeError

If the adapter has not been fit yet.

get_params(deep=True)

Return initialization parameters for cloning utilities.

Parameters:

Name Type Description Default
deep bool

Included for scikit-learn compatibility. This adapter does not expose nested estimators, so the value does not change the output.

True

Returns:

Type Description
dict[str, Any]

A shallow copy of the stored initialization parameters.

set_params(**params)

Update parameters and rebuild the underlying CatBoost model.

Parameters:

Name Type Description Default
**params Any

Keyword parameters to merge into the stored initialization parameters.

{}

Returns:

Type Description
CatBoostAdapter

The updated adapter instance (self).

Notes

This method updates self.params and then re-instantiates catboost.CatBoostRegressor using the merged parameter set.