I have trained a model for spam classification -
This is my code -
X_train, X_test, y_train, y_test = train_test_split(data['text'], data['label'], test_size = 0.4, random_state = 1)
cv = CountVectorizer()
cv.fit(X_train)
cv.fit(X_test)
X_train = cv.transform(X_train)
X_test = cv.transform(X_test)
model = LogisticRegression(solver='lbfgs')
model.fit(X_train, y_train)
After that I had also completed testing, it gives me an accuracy of about 97% .
Now I want to add predict a new SMS/Email to be spam or not. What I am doing is -
new = 'Hey there you got a sale here on website'
new = cleanText(new)
cv.fit([new])
new = cv.transform([new])
model.predict(new)
It gives me an error
ValueError: X has 4 features per sample; expecting 4331
Please tell me where I am going wrong?