Search code examples
pythonmachine-learningtransformattributeerrortfidfvectorizer

AttributeError: 'TfidfVectorizer' object has no attribute 'tranform'


I keep on getting this error for this code,

x_predict = ['facebook.com', 'google.com/search=phish', 'wikipedia.com']

x_predict = vectorizer.tranform(x_predict)

y_predict = lgr.predict(x_predict)

print(y_predict)


Solution

  • This is spelling error:

    Use transform instead of tranform

    x_predict = vectorizer.transform(x_predict)