亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Python:使用scikit-learn進行預測,給出空白預測

Python:使用scikit-learn進行預測,給出空白預測

千萬里不及你 2021-03-16 17:12:48
我從事客戶支持工作,在給定一組培訓票證的情況下,我正在使用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'), ()]我不明白為什么訓練集中沒有空白()的原因。它不應該預測最接近的標簽嗎?誰能推薦我正在使用的模型的任何改進?非常感謝您的提前幫助!
查看完整描述

2 回答

  • 2 回答
  • 0 關注
  • 329 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號