I work in customer support, and I use scikit-learn to predict tags for our tickets, given the set of training tickets (about 40,000 tickets in the training set).
I use a classification model based on this . It predicts simply "()" as tags for many of my test ticket sets, although none of the tickets in the training set contain tags.
My training data for tags is a list of lists, for example:
tags_train = [['international_solved'], ['from_build_guidelines my_new_idea eligibility'], ['dropbox other submitted_faq submitted_help'], ['my_new_idea_solved'], ['decline macro_backer_paypal macro_prob_errored_pledge_check_credit_card_us loading_problems'], ['dropbox macro__turnaround_time other plq__turnaround_time submitted_help'], ['dropbox macro_creator__logo_style_guide outreach press submitted_help']]
Although my training data for ticket descriptions is just a list of strings, for example:
descs_train = ['description of ticket one', 'description of ticket two', etc]
Here is the relevant part of my code to build the model:
import numpy as np import scipy from sklearn.pipeline import Pipeline from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfTransformer from sklearn.multiclass import OneVsRestClassifier from sklearn.svm import LinearSVC
However, "predicted" gives a list that looks like this:
predicted = [(), ('account_solved',), (), ('images_videos_solved',), ('my_new_idea_solved',), (), (), (), (), (), ('images_videos_solved', 'account_solved', 'macro_launched__edit_update other tips'), ('from_guidelines my_new_idea', 'from_guidelines my_new_idea macro__eligibility'), ()]
I don’t understand why it predicts blank () when they are not in the training set. Shouldn't he predict the nearest tag? Can anyone recommend any improvements to the model I'm using?
Thank you so much for your help in advance!