Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add catboost classifier support #1403

Merged
merged 10 commits into from
Oct 3, 2023
Merged

Add catboost classifier support #1403

merged 10 commits into from
Oct 3, 2023

Conversation

krishanbhasin-gc
Copy link
Contributor

@krishanbhasin-gc krishanbhasin-gc commented Sep 20, 2023

Reviving #529.

From the original PR description

add catboost support:

  • add a new runtime by heavily copying lightgbm runtime
  • add test that builds a model, sends an inference request, validates the prediction
  • add example in docs
  • list in index/readme

I have only resolved merge conflicts and done a first pass of reshaping some of the configuration files to match the new poetry approach.


Looking ahead to adding support for the Regressor and Ranker models, given catboost/catboost#2504 we can't use the same approach as XGBoost (using a try-catch:

def _load_sklearn_interface(model_uri: str) -> XGBModel:
try:
regressor = xgb.XGBRegressor()
regressor.load_model(model_uri)
return regressor
except TypeError:
# If there was an error, it's likely due to the model being a
# classifier
classifier = xgb.XGBClassifier()
classifier.load_model(model_uri)
return classifier
).

It might be worth creating 3 separate MLModel child classes, one for each of Classifier, Regressor, and Ranker instead. Could this fit the design approach of the project?

@krishanbhasin-gc krishanbhasin-gc changed the title Add catboost support Add catboost classifier support Sep 20, 2023
@krishanbhasin-gc krishanbhasin-gc marked this pull request as ready for review September 20, 2023 13:45
Copy link
Contributor

@adriangonz adriangonz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @krishanbhasin-gc ,

Apologies for the delay reviewing this one.

This is great work! Thanks a lot for jumping on top of this one! 🚀 From my point of view, this looks great as-is. Once the tests are all good, we should be able to merge this one.

On what you mention around classifiers vs regressors, I think we should land this one as a first iteration and then open an issue to add support for extra types of CatBoost models. It's a shame the framework itself doesn't give us any way to differentiate between artefacts - in that case, we may need to add some extra config field to the model-settings.json to select between model types.

@adriangonz
Copy link
Contributor

Actually, tests are already all green - so we should be good to go with this one. Great work @krishanbhasin-gc ! 👍

@adriangonz adriangonz merged commit 90c3520 into SeldonIO:master Oct 3, 2023
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants