问题描述
我正在尝试使用增量模型textblob.classifiers.DecisionTreeClassifier进行文本分类。 为此,我尝试运行官方文档中给出的示例。 例子是:
from textblob.classifiers import DecisionTreeClassifier
train = [
('I love this sandwich.','ytjtnytybhjthty'),('this is an amazing place!',('I feel very good about these beers.','pos'),('this is my best work.',("what an awesome view",('I do not like this restaurant','neg'),('he is my sworn enemy!',('my boss is horrible.','neg')]
clf = DecisionTreeClassifier(train)
之后,我尝试通过添加带有新标签的新样本来更新模型。但始终会映射基本标签之一:
new_data = [('She is my best friend.','newLabel'),('She is my best friend.',]
clf.update(new_data)
clf.classify(new_data[0])
'neg'
是否可以在基本标签上添加新标签?有没有办法解决这个问题,甚至使用另一种增量算法? sklearn.naive_bayes.MultinomialNB我有同样的问题
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)