0
$\begingroup$

Dataframe:

id    review                                              name         label
1     it is a great product for turning lights on.        Ashley       1
2     plays music and have a good sound.                  Alex         1
3     I love it, lots of fun.                             Peter        0

The aim is to classify the text; if the review is about the functionality of the product (e.g. turn the light on, music), label=1, otherwise label=0. How can I improve the accuracy of LinearSVC; I tried difference models but LinearSVC gives the highest accuracy but it is still not enough:

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.20, random_state=42)
text_clf_lsvc = Pipeline([('tfidf', TfidfVectorizer()), ('clf', LinearSVC(loss='hinge',
                  penalty='l2', max_iter = 100))])

metrics.accuracy_score(y_test,predictions) is 0.84 at this stage. I would appreciate your advice.

$\endgroup$
1
$\begingroup$

There are many ways to increase the accuracy.

1.) Try to get more data. More data usually helps in getting better results. (usually, not always!)

2.) Although you mention you have tried different models and I'm not sure how many, but there are still more models you can try.

3.) Try hyperparameter tuning for all the models you have tried, not only for linear SVC.

4.) Try to use different preprocessing techniques other than Tfidf to see which yields best results.

$\endgroup$
1
$\begingroup$

Additionally to the previous answer, I would go for POS tagging features (features that count the number of verbs, adverbs, nouns, etc contained in your review), since you are trying to distinguish between two kind of reviews, it sounds reasonable to think that something that talks about the function of the product has for example more adjetives.

Of course you can add those as additional features to your BagOfWords vectorizer.

Additionally if you can try different ngrams combinations it might work, from my experience when using those basic embedding, adding bigrams helps a lot

Finally I would go for a non linear kernel, you may check via CV if it works better than a model with a linear one.

$\endgroup$
2
  • $\begingroup$ Thanks, @Julio. CV? $\endgroup$
    – SaNa
    Sep 25 at 3:51
  • 1
    $\begingroup$ cross validation $\endgroup$ Sep 26 at 19:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.