Python 3.x 如何更快地训练TextBlob MaxEntClassifier?

Python 3.x 如何更快地训练TextBlob MaxEntClassifier?,python-3.x,nltk,sentiment-analysis,textblob,Python 3.x,Nltk,Sentiment Analysis,Textblob,我正在使用Textblob MaxEntClassifier进行情绪分析,只对积极类和消极类进行分析。在一个相当小的训练集中,3800条短推,训练时间太长了,大约1小时15分钟。TextBlob经过“训练(100次迭代)”,即使在32次迭代后日志可能性和准确性停止变化。(顺便说一句,我有12gb的RAM和3.4ghz的处理器,在后台运行的处理器不多) 我看到Textblob MaxEntClassifier是NLTK的包装器。我在上面提到的“train(*args,**kwargs)-使用标记的

我正在使用Textblob MaxEntClassifier进行情绪分析,只对积极类和消极类进行分析。在一个相当小的训练集中,3800条短推,训练时间太长了,大约1小时15分钟。TextBlob经过“训练(100次迭代)”,即使在32次迭代后日志可能性和准确性停止变化。(顺便说一句,我有12gb的RAM和3.4ghz的处理器,在后台运行的处理器不多)

我看到Textblob MaxEntClassifier是NLTK的包装器。我在上面提到的“train(*args,**kwargs)-使用标记的特征集训练分类器并返回分类器。使用与包装的NLTK类相同的参数

由于TextBlob MaxEntClassifier训练采用与包装的NLTK类相同的参数,因此我查看了NLTK文档中可能缩短训练时间的参数。在MaxEnt分类器的下面,我找到了参数“min_lldelta=v:如果单个迭代将对数可能性提高小于v,则终止”。我希望我可以通过TextBlob将这个参数传递给NLTK分类器以缩短训练时间,但是它似乎被忽略了

是否可以通过Textblob MaxEntClassifier将max_iter、min_ll或min_lldelta传递给NLTK以缩短训练时间?如果没有,是否有其他方法缩短培训时间

我的片段如下:

# Most code below from: https://stevenloria.com/simple-text-classification/

from textblob.classifiers import MaxEntClassifier

train = [
    ('I love this sandwich.', 'pos'),
    ('This is an amazing place!', 'pos'),
    ('I feel very good about these beers.', 'pos'),
    ('This is my best work.', 'pos'),
    ("What an awesome view", 'pos'),
    ('I do not like this restaurant', 'neg'),
    ('I am tired of this stuff.', 'neg'),
    ("I can't deal with this", 'neg'),
    ('He is my sworn enemy!', 'neg'),
    ('My boss is horrible.', 'neg')
]
test = [
    ('The beer was good.', 'pos'),
    ('I do not enjoy my job', 'neg'),
    ("I ain't feeling dandy today.", 'neg'),
    ("I feel amazing!", 'pos'),
    ('Gary is a friend of mine.', 'pos'),
    ("I can't believe I'm doing this.", 'neg')
]

print("\nTraining...")
classifier = MaxEntClassifier(train, min_lldelta = 0.5)
print("\nkwargs: ", classifier.format_kwargs)

print("\nTesting...")
results = classifier.accuracy(test)