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

Question for python_deployer.deploy_python_closure - case of multiple outputs from func #769

Open
sean-sj-jung opened this issue May 14, 2020 · 0 comments

Comments

@sean-sj-jung
Copy link

I am using Catboost (https://catboost.ai/) for classification and have a bit of complication with return values.

In case of xgboost, when you run xgboost.predict(xgb.DMatrix(x)), it returns a single value which gives the probability of a sample being in class 1 against class 0.

Catboost, however, returns both values (https://catboost.ai/docs/concepts/python-reference_catboostclassifier_predict_proba.html)
for example.
a, b = catboost_model.predict_proba(data)
where a = probability of being class 0, b = probability of being class 1,
and a+b should be equal to 1.

I defined my 'func' to be

def predict(x):
a, b = cat_clf.predict_proba(x)
return b

as I need the second value, the probability of being class 1, and put that in my model. The problem is, when I run the app, it somehow returns the value of 'a' instead of 'b'.
I saw your pytorch example (https://github.com/ucbrise/clipper/blob/develop/examples/frameworks/pytorch_on_docker_example.ipynb) and here you can see the identical behavior. cell number [7], the model returns two values but in cell number [21], the 'output' is the first value only.
How can I make it return the second value?

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

No branches or pull requests

1 participant