我有一个包含 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 和朴素贝叶斯对我的数据集进行分类。
我想使用的数据集:链接
样本(训练数据集):
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
如何有效地训练这个庞大的数据集?