python-3.x/ scikit-learn
For the below line of code to get the metrics, I'm getting the ValueError mentioned
f1_test.append(f1_score(y_test, y_pred_test, pos_label="str"))
ValueError: pos_label='str' is not a valid label: array([' <=50K', ' >50K'], dtype='
My data has Income vlaue <=50k or >50k.
Please advise.
The parameter pos_label is used to indicate the positive class. In your data, your labels are string based '<=50K' and '>50K'.
You can do one of the following:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.