#Help with an error
65 messages · Page 1 of 1 (latest)
i checked it
Look, this is not a regression task it's a classification task
regression would be for predicting an item in a sequence or continuous function. Detecting emotion is more along the lines of classification
You even have it in your code as "label"
so what should I do ?
what is the model you are training to classify?
Logistic Regression
change it to a classifier
what is the model you import?
Give the import line + model initialization code
Ok.... that's not helpful
still not helpful
you loaded the lg variable from a pkl file. That doesn't tell me what the model is
the model could be a SVM, KNN, random tree/forest, MLP/NN, etc
I'll share the jupyter file
Looking at your error, go back and make sure your df_test is the same as your df_train after you transform both with the TF-IDF vectorizer
oh okay
the error you gave points to the vectorizor calling predict() which is not right
yep but it says tfidfvectorizer has no attribute predict
yes, that's correct
but predict is being used with logistic regression model
yup
but for some reason, the program is seeing lg as a TFIDFVectorizer -> which does NOT have .predict()
yeah
What happens when you output type(tf_test) and type(tf_train)?
I ask because you use the vectorizor on those datasets differently.
you fit_transform on train data but only transform on the test data
scipy.sparse._csr.csr_matrix
for both?
yup
what about type(lg)?
sklearn.linear_model._logistic.LogisticRegression
Hmmm.....
@muted night do the same for inpvector
It's odd that the part that's throwing an error is a function you never call in your code.
list
its inside a function i executed the function on string seperately
they are trained on matrix that contains sentences and emotion
Right but after your tfidf vectorizer transforms the text, it should be in csr/csc matrix
Yeah but you have to print the type of inpvector from within the function
otherwise inpvector is going to be None because the variable is out of scope (of the function)
<class 'sklearn.linear_model._logistic.LogisticRegression'>
Hmmm... Rerun it all again
okayy
because in your screenshot, you should have gotten the error again when you called your function but it ran just fine.
done
Any error messages?
nope
Then I think you're all set