【发布时间】:2015-03-13 06:55:06
【问题描述】:
我有一个包含 1600000 条推文的训练数据集。我该如何训练这种类型的海量数据。
我尝试过使用nltk.NaiveBayesClassifier。如果我跑步的话,需要5天以上的时间来训练。
def extract_features(tweet):
tweet_words = set(tweet)
features = {}
for word in featureList:
features['contains(%s)' % word] = (word in tweet_words)
return features
training_set = nltk.classify.util.apply_features(extract_features, tweets)
NBClassifier = nltk.NaiveBayesClassifier.train(training_set) # This takes lots of time
我该怎么办?
我需要使用 SVM 和朴素贝叶斯对我的数据集进行分类。
我要使用的数据集:Link
样本(训练数据集):
Label Tweet
0 url aww bummer you shoulda got david carr third day
4 thankyou for your reply are you coming england again anytime soon
示例(测试数据集):
Label Tweet
4 love lebron url
0 lebron beast but still cheering the til the end
^
I have to predict Label 0/4 only
如何有效地训练这个庞大的数据集?
【问题讨论】:
-
使用
scikit-learn并试用panda。 160万不算多。鉴于词汇量约为 100 万。并删除单例 -
您能否将数据发布到 gdrive 上的某个地方或其他地方,然后我们可以尝试为您找到解决方案。
-
您要预测哪些类?和推文开头的数字有关系吗?
-
是否一定要使用朴素贝叶斯,还是只要训练好的模型足够准确就可以了?
标签: python classification nltk svm naivebayes