# How can I imporve accuracy for text classification and mapping using SVM?

I am working on a problem where I need to predict the text corresponding to another text in my training data file. For example: if I have value like the software in one of my columns and another corresponding column holds a value adobe pdf for it then my algorithm should be able to predict the same for my test data as well. For example, if my test data has Tableau then the predicted category should be software corresponding to it. here are data options like Software, Tax, etc and corresponding to them there are subcategories. My job is to predict the right sub-category against the primary category in my test data.

What should I do to increase my accuracy? Is n_ngram affecting the accuracy a lot? I could see some but not a lot.

from sklearn.featureextraction.text import CountVectorizer from sklearn.featureextraction.text import TfidfTransformer
from sklearn.multiclass import OneVsRestClassifier
from sklearn.svm import LinearSVC
#preparing the final pipeline using the selected parameters
model = Pipeline([('vectorizer', CountVectorizer(ngramrange=(1,4))), ('tfidf', TfidfTransformer(useidf=True)),
('clf', OneVsRestClassifier(LinearSVC(class_weight="balanced")))])


I have already used SVM and linear SVC for doing the classification but my accuracy is only 78%. My training data set is in German with no stop words as these are categories and not plain long text.

• I don't think is clear what you are predicting. Maybe you can be more specific about your data/input and classification labels. – Iordanis Aug 10 at 10:06
• What I want is to predict a simple thing: if my train data has two cols for example category = software and subcategory = tableau, my model will learn this and predict this correctly, I am doing this using SVM. for my test data , now the same algo should do the trick. For example, if I pass subcategory = tableau I should get the predicted category = software.. – user79322 Aug 10 at 12:14