CatBoost

CatBoost model implementations.

class openadmet.models.architecture.catboost.CatBoostClassifierModel(**extra_data: Any)[source]

Bases: CatBoostModelBase

CatBoost classification model.

Common parameters for CatBoost models can be found at: https://catboost.ai/docs/en/concepts/python-quickstart

mod_class

alias of CatBoostClassifier

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.

predict_proba(X: ndarray) ndarray[source]

Predict using the model, returning probabilities for each class.

Parameters:

X (np.ndarray) – Data to predict on

Returns:

Probabilities for each class from the model

Return type:

np.ndarray

type: ClassVar[str] = 'CatBoostClassifierModel'
class openadmet.models.architecture.catboost.CatBoostModelBase(**extra_data: Any)[source]

Bases: PickleableModelBase

Base class for CatBoost models, allows instantiation from parameters that are passable to the CatBoost model classes.

Variables:
  • type (ClassVar[str]) – The type of the model.

  • mod_class (ClassVar[type]) – To specify the CatBoost model class (e.g., CatBoostRegressor or CatBoost Classifier)

build()[source]

Prepare the model.

mod_class: ClassVar[type]
model_config: ClassVar[ConfigDict] = {'extra': 'allow'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.

predict(X: ndarray, **kwargs) ndarray[source]

Predict using the model.

Parameters:
  • X (np.ndarray) – Data to predict on

  • kwargs (dict) – Additional keyword arguments to pass to the predict method of the CatBoost model

Returns:

Predictions from the model

Return type:

np.ndarray

train(X: ndarray, y: ndarray)[source]

Train the model.

Parameters:
  • X (np.ndarray) – Training data features

  • y (np.ndarray) – Training data labels

type: ClassVar[str]
class openadmet.models.architecture.catboost.CatBoostRegressorModel(**extra_data: Any)[source]

Bases: CatBoostModelBase

CatBoost regression model.

Common parameters for CatBoost models can be found at: https://catboost.ai/docs/en/concepts/python-quickstart

Common parameters that you might want to set include: - n_estimators: Number of trees in the ensemble - max_depth: Maximum depth of a tree - max_leaves: Maximum number of leaves in a tree - learning_rate: Step size shrinkage used in update to prevent overfitting - objective: Specify the learning task and corresponding objective function - booster: Specify which booster to use, options are gbtree, gblinear or dart - tree_method: Specify the tree construction algorithm used in CatBoost

mod_class

alias of CatBoostRegressor

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.

type: ClassVar[str] = 'CatBoostRegressorModel'