Here's a high-level blueprint of my model -
CATEGORY SERVICE TITLE DEPARTMENT apple fruits i love eating fruits. fruitshop mango fruits mangoes are yellow in color. fruitshop cycle vehicle that cycle is really expensive. motorshop
I convert this to a sparse matrix with Tf-Idf scores, where the columns are the
title columns tokenized.
I am using
StratifiedKFold (n_splits = 10, random_state=777, shuffle=True) able to achieve a prediction accuracy of 73%.
Got 2 doubts -
1) What happens when a string like "fresh fish" is used for classification? Because the words "fresh" and "fish" are never used before, which department will this be classified into?
2) How can I consume this string "fresh fish" in my model?
Currently, I have something like this -
... # X.shape = (1181, 1930) # y.shape = (1181,) X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=777) ... pr = mod.predict(X_test) print(pd.DataFrame(confusion_matrix(y_test, pr))) ...
I tried giving input as
print(mod.predict([["fresh fish"]])) but got an error -
ValueError: X has 1 features per sample; expecting 1930
Please advise. Thanks.