CatBoost Regressor

class aydin.regression.cb.CBRegressor(num_leaves: Optional[int] = None, max_num_estimators: Optional[int] = None, min_num_estimators: Optional[int] = None, max_bin: Optional[int] = None, learning_rate: Optional[float] = None, loss: str = 'l1', patience: int = 32, compute_load: float = 0.95, gpu: bool = True, gpu_use_pinned_ram: Optional[bool] = None, gpu_devices: Optional[Sequence[int]] = None)[source]

The CatBoost Regressor uses the gradient boosting library <a href=”https://github.com/catboost”>CatBoost</a> to perform regression from a set of feature vectors and target values. CatBoost main advantage is that it is very fast compared to other gradient boosting libraries – in particular when GPU acceleration is available. Compared to other libraries (lightGBM, XGBoost) it is much easier to ship the GPU enabled version because it just works. It performs comparably and sometimes better than other libraries like LightGBM.

fit(x_train, y_train, x_valid=None, y_valid=None, regressor_callback=None)

Fits function y=f(x) given training pairs (x_train, y_train). Stops when performance stops improving on the test dataset: (x_test, y_test). The target y_train can have multiple ‘channels’. This will cause multiple regressors to be instanciated internally to be able to predict these channels from the input features.

Parameters
x_train

x training values

y_train

y training values

x_valid

x validation values

y_valid

y validation values

regressor_callback

regressor callback

static load(path: str)

Returns an ‘all-batteries-included’ regressor from a given path (folder).

Parameters
path

path to load from.

Returns
thawedobject
predict(x, models_to_use=None)

Predicts y given x by applying the learned function f: y=f(x) If the regressor is trained on multiple ouput channels, this will return the corresponding number of channels…

Parameters
x

x values

models_to_use
Returns
numpy.typing.ArrayLike

inferred y values

recommended_max_num_datapoints() int[source]

Recommended maximum number of datapoints

Returns
int
save(path: str)

Saves an ‘all-batteries-included’ regressor at a given path (folder).

Parameters
path

path to save to

Returns
frozenEncoded JSON object
stop_fit()[source]

Stops training (can be called by another thread)