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

ValueError: Unknown label type: 'continuous' #499

Closed
ya-stack opened this issue Apr 19, 2022 · 6 comments
Closed

ValueError: Unknown label type: 'continuous' #499

ya-stack opened this issue Apr 19, 2022 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@ya-stack
Copy link

ya-stack commented Apr 19, 2022

Can you please tell how shall I use BaseSClassifier to fit and find feature importance. I have converted data type of label into "object" still I am getting the error - ValueError: Unknown label type: 'continuous'
Waiting for your reply.
Thanks!

image

Snippet of Dataset looks like:
image

@ya-stack ya-stack added the bug Something isn't working label Apr 19, 2022
@paullo0106
Copy link
Collaborator

Thanks for reaching out, @ya-stack

Do you mind providing a complete error msg/ log for the ValueError? that would be helpful

@paullo0106
Copy link
Collaborator

if the error comes from that estimate_ate() line, let me know how the below works (one possible cause is this):

slearner.estimate_ate(X, w_multi, y.astype('int'))

and I would want to double-check below as well

from sklearn.utils.multiclass import type_of_target
print(type_of_target(y))

@ya-stack
Copy link
Author

ya-stack commented Apr 26, 2022

Hi Paul, thanks for the reply.
I am getting the value error while finding feature importance using "get_importance" method. I have changed the dtype of y_train to category and tried to fit RandomForestClassifier() to find feature importance using Shap values. Please find below the snippets for your reference.

Waiting for your response.
Thanks in advance!

image

image

@paullo0106
Copy link
Collaborator

hmm so it seems fit_predict() worked fine, can you click on the "5 frames" to expand the error msg for me? and have you tried passing in with y_train.astype('int')? thanks

@ya-stack
Copy link
Author

ya-stack commented Apr 28, 2022

Hi Paul,
Yes fit_predict is working fine. I am getting an error while finding features importance.
Also, I have changed the type of y_train to 'int'. Please find attached the snippets for an additional reference.
Thanks!

image

image

@paullo0106 paullo0106 self-assigned this Apr 29, 2022
@jeongyoonlee
Copy link
Collaborator

Hi @ya-stack, the model_tau_feature should be regressor because it predicts the treatment effect, τ, which is continuous regardless the type of the outcome, y. Please try:

model_tau_feature = RandomForestRegressor()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants