添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

ValueError: pos_label=1 is not a valid label: array(['COLLECTION', 'PAIDOFF'], dtype='<U10')

Ask Question

I have face this error of pos_label firstly I import this library

from sklearn.metrics import jaccard_similarity_score

because of Version error I again import this library

from sklearn.metrics import jaccard_score

This is my code for running:

depth_range = range(1, 10)
jaccard_similarity_score_ = []
f1_score_ = []
for d in depth_range:
    dt = DecisionTreeClassifier(criterion = 'gini', max_depth = d)
    dt.fit(X_train, y_train)
    dt_yhat = dt.predict(X_test)
    ja = jaccard_score(y_test, dt_yhat, "yes")
    jaccard_similarity_score_.append(ja)
    f1_score_.append(f1_score(y_test, dt_yhat, average = 'weighted'))

I get this error :

ValueError: pos_label=1 is not a valid label: array(['COLLECTION', 'PAIDOFF'], dtype='<U10')

Hi, can you show us the data set a bit? like maybe the first 5 rows and the names of the columnes? otherwise I think there is not enough information to figure out what's wrong. – ItIsEntropy Jan 11, 2021 at 11:26

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.