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

mapping predict_proba columns to class labels #82

Closed
philrhinehart opened this issue Feb 14, 2018 · 2 comments
Closed

mapping predict_proba columns to class labels #82

philrhinehart opened this issue Feb 14, 2018 · 2 comments

Comments

@philrhinehart
Copy link

When building a model (e.g. SuperLearner) with proba=True on the meta estimator, how can I access the class labels for the model.predict() output columns.

sklearn classifiers generally expose a classes_ property with the class labels, however this doesn't appear to be available on the mlens ensemble classes.

What is the preferred way to map the prediction output columns to class labels?

@flennerhag
Copy link
Owner

Currently, ml-ensemble only handles numerical class labels. In this case, the class label corresponds to the column index, so there shouldn't be any need to access a classes_ attribute. For instance, an ensemble of two estimators with 2 class labels would have the following column structure:

col=0 col=1 col=2 col=3
est=0 est=0 est=1 est=1
label=0 label=1 label=0 label=1

If you really want to access the classes_ attribute of an estimator, you can with

sl.layer_1.learners[0]._learner_[0].estimator.classes_

Adjust for the layer and estimator you want to look at. Note that the backend structure may change so this way of access the classes_ attribute can break without warning.

@philrhinehart
Copy link
Author

Ok, thanks! I had a feeling this was the case but wasn't sure if it was a guarantee.

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

2 participants