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

TypeError: 'int' object is not iterable #125

Open
JianfengQiao opened this issue Dec 9, 2020 · 1 comment
Open

TypeError: 'int' object is not iterable #125

JianfengQiao opened this issue Dec 9, 2020 · 1 comment

Comments

@JianfengQiao
Copy link

When run crf.fit(X_train, y_train) during the text classification task, pop up "TypeError: 'int' object is not iterable". X_train is the float array(Tfidf), y_train (series) is corresponding labels.

https://stackoverflow.com/questions/56285456/typeerror-numpy-int32-object-is-not-iterable-error-while-using-sklearn-crfs

@yye1
Copy link

yye1 commented Nov 30, 2021

y_train should include label for each word and not only for each sentence, so it should be series of lists of labels.
for example for the sentence "how are you", y_train should be a series that include one list [0,0,1] (random values, but the length should be 3, one label for each word)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants