Skip to content

CatBoostRegressor.load_model() loads a CatBoostClassifier model (from cbm type) without raising an error #2504

Description

@krishanbhasin-gc

Problem:
CatBoostRegressor.load_model() loads a CatBoostClassifier model (from cbm type) without raising an error
catboost version: 1.2.2.
It produces outputs that can be interpreted as a classification (>0 maps to 1, <0 maps to 0), however I think a preferred behaviour would be to raise an error
Operating System: Linux
CPU: N/A
GPU: N/A

Minimally repreducable example
import catboost as cb
import numpy as np

x = np.arange(0,100,2).reshape((50, 1))
y = np.random.randint(2, size=50)


cbc = cb.CatBoostClassifier(silent=True)

cbc.fit(x,y)

cbc.predict(x)

cbc.save_model('classifier')



cbr = cb.CatBoostRegressor(silent=True)

# doesn't Raise
cbr.load_model('classifier')


# Produces a prediction
cbr.predict(x)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions