0
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ I don't think is clear what you are predicting. Maybe you can be more specific about your data/input and classification labels. $\endgroup$ – Iordanis Aug 10 at 10:06
  • $\begingroup$ 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.. $\endgroup$ – user79322 Aug 10 at 12:14
0
$\begingroup$

A general good approach for high dimensional text data would be to use a word embedding and neural networks. If you want to stick to the models and approach you are using, I suggest you don't over-engineer your dataset and first try with simple bag of word approaches and while cross-validating try different n-grams, pos-tagging but I suspect the very high dimensional feature space is bringing your accuracy score down.

$\endgroup$

Your Answer

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