问题描述
我正在使用 Snorkel Labeling Package 以编程方式标记我的未标记训练数据。我像https://www.snorkel.org/use-cases/01-spam-tutorial
from textblob import TextBlob
@labeling_function()
def lf_sent_blob(x):
sent = TextBlob(x.text).sentiment.polarity
if sent>0:
return positive
elif sent<0:
return negative
else:
#return neutral
return ABSTAIN
from snorkel.labeling.model import LabelModel
from snorkel.labeling import PandasLFApplier
from snorkel.labeling import LFAnalysis
lfs = [lf_sent_emoji,lf_has_special,lf_has_capital,lf_not_ABSTAIN_v2,lf_not_ABSTAIN_v1,lf_sent_blob]
# Apply the LFs to the unlabeled training data
applier = PandasLFApplier(lfs)
L_train = applier.apply(df)
# here you analyze your labels
LFAnalysis(L=L_train,lfs=lfs).lf_summary()
这是我的问题,如果一开始我定义类标签值如下,分析结果是有意义的。例如,lf_sent_blob 标签函数的标签覆盖范围或标签极性是有意义的。例如 Polarity 根据标签矩阵中的证据推断每个 LF 的极性。
positive = 1
negative = 0
ABSTAIN = -1 # -1 should be reserved for abstain!?
但是,当我将其更改为对我来说更有意义的内容时:
positive = 1
negative = -1
ABSTAIN = 0
我收到的结果不正确
这是我的问题,如果所有员工都有意义,那么 -1 整数值是否保留给浮潜中的 ABSTAIN 课程?!!!如果是的话,为什么他们没有在他们的教程或文档中提到它?!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)