Catboost models#

class giskard.models.catboost.CatboostModel(model, model_type: SupportedModelTypes | Literal['classification', 'regression', 'text_generation'], name: str | None = None, data_preprocessing_function: Callable[[DataFrame], Any] | None = None, model_postprocessing_function: Callable[[Any], Any] | None = None, feature_names: Iterable | None = None, classification_threshold: float | None = 0.5, classification_labels: Iterable | None = None, id: str | None = None, batch_size: int | None = None, **kwargs)#

Automatically wraps catboost models for use with Giskard.

Parameters:
  • model (Any) – The model that will be wrapped.

  • model_type (ModelType) – The type of the model. Must be a value from the ModelType enumeration.

  • data_preprocessing_function (Callable[[pd.DataFrame], Any], optional) – A function that will be applied to incoming data. Default is None.

  • model_postprocessing_function (Callable[[Any], Any], optional) – A function that will be applied to the model’s predictions. Default is None.

  • name (str, optional) – A name for the wrapper. Default is None.

  • feature_names (Optional[Iterable], optional) – A list of feature names. Default is None.

  • classification_threshold (float, optional) – The probability threshold for classification. Default is 0.5.

  • classification_labels (Optional[Iterable], optional) – A list of classification labels. Default is None.

  • batch_size (Optional[int], optional) – The batch size to use for inference. Default is None, which means inference will be done on the full dataframe.

classmethod load_model(local_dir)#

Loads the wrapped model object.

Parameters:

path (Union[str, Path]) – Path from which the model should be loaded.

save_model(local_path, mlflow_meta: Model)#

Saves the wrapped model object.

Parameters:

path (Union[str, Path]) – Path to which the model should be saved.