MultinomialNB error: “Unknown Label Type”

前端 未结 2 746
情书的邮戳
情书的邮戳 2021-01-05 01:33

I have two numpy arrays, X_train and Y_train, where the first of dimensions (700,1000) is populated by the values 0, 1, 2, 3, 4, and 10. The second of dimensions (700,) is p

相关标签:
2条回答
  • 2021-01-05 02:07

    The problems seems to be the dtype of y. looks like numpy didnt manage to figure out it was a string. so it was set to a generic object. If you change:
    Y = np.asarray(critics['fresh']) to Y = np.asarray(critics['fresh'], dtype="|S6") i think it should work.

    0 讨论(0)
  • 2021-01-05 02:10

    I also faced the same problem. Numpy sometimes fails t detect datatype of array. So, we give it explicitly. here is the documentation of all the types by numpy. Select datatype according to your requirement and provide it as "dtype=" attribute.

    0 讨论(0)
提交回复
热议问题