我從事客戶支持工作,在給定一組培訓票證的情況下,我正在使用scikit-learn來預測我們機票的標簽(培訓集中約40,000張票證)。我正在使用基于此模型的分類模型。即使訓練集中的所有票證都沒有標簽,它也只是將“()”作為我的許多票證測試組的標簽進行預測。我的標簽訓練數據是一個列表列表,例如: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']]雖然我的票務說明訓練數據只是一個字符串列表,例如:descs_train = ['description of ticket one', 'description of ticket two', etc]這是構建模型的代碼的相關部分:import numpy as npimport scipyfrom sklearn.pipeline import Pipelinefrom sklearn.feature_extraction.text import CountVectorizerfrom sklearn.feature_extraction.text import TfidfTransformerfrom sklearn.multiclass import OneVsRestClassifierfrom sklearn.svm import LinearSVC# We have lists called tags_train, descs_train, tags_test, descs_test with the test and train dataX_train = np.array(descs_train)y_train = tags_trainX_test = np.array(descs_test) classifier = Pipeline([ ('vectorizer', CountVectorizer()), ('tfidf', TfidfTransformer()), ('clf', OneVsRestClassifier(LinearSVC(class_weight='auto')))])classifier.fit(X_train, y_train)predicted = classifier.predict(X_test)但是,“預測”給出的列表如下: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'), ()]我不明白為什么訓練集中沒有空白()的原因。它不應該預測最接近的標簽嗎?誰能推薦我正在使用的模型的任何改進?非常感謝您的提前幫助!
添加回答
舉報
0/150
提交
取消