You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to know if it is possible to use "compute_sample_weight" within "cross_val_predict" to provide sample weights in fit_params?
I'm using the following code: y_pred = cross_val_predict(clf, X, y, cv = cv, method = 'predict', fit_params = {'sample_weight':compute_sample_weight("balanced", y)})
But I think that it is not correct because compute_sample_weight("balanced", y) computes weights for all labels, whereas I would like that this function successively applied on each training set generated by the split operated by cross_val_predict. I think that the parameter "indices" of compute_sample_weight() could be a solution, but I don't know how to apply it.
The text was updated successfully, but these errors were encountered:
No there is no straightforward way to do this at the moment. Consider using
the Pipeline from the imblearn library for now. This will be solved with
#3855 I hope.
I meant which feature of Imbalanced learn could help? Because I don't want to resample X and y, I just want to recalculate sample_weight according to X and y.
I would like to know if it is possible to use "compute_sample_weight" within "cross_val_predict" to provide sample weights in fit_params?
I'm using the following code:
y_pred = cross_val_predict(clf, X, y, cv = cv, method = 'predict', fit_params = {'sample_weight':compute_sample_weight("balanced", y)})
But I think that it is not correct because
compute_sample_weight("balanced", y)
computes weights for all labels, whereas I would like that this function successively applied on each training set generated by the split operated by cross_val_predict. I think that the parameter "indices" of compute_sample_weight() could be a solution, but I don't know how to apply it.The text was updated successfully, but these errors were encountered: