【发布时间】:2014-07-20 21:39:40
【问题描述】:
我将使用 LIBLINEAR 为基于转换的依赖项解析做一些工作。但我很困惑如何使用它。如下:
我为基于转换的依赖解析的训练和测试过程设置了 3 个特征模板:
1. the word in the top of the stack
2. the word in the front of the queue
3. information from the current tree formed with the steps
而LIBLINEAR中定义的特征是:
FeatureNode(int index, double value)
一些例子:
LABEL ATTR1 ATTR2 ATTR3 ATTR4 ATTR5
----- ----- ----- ----- ----- -----
1 0 0.1 0.2 0 0
2 0 0.1 0.3 -1.2 0
1 0.4 0 0 0 0
2 0 0.1 0 1.4 0.5
3 -0.1 -0.2 0.1 1.1 0.1
但我想在某个阶段定义我的特征,例如(一句话“我爱你”):
feature template 1: the word is 'love'
feature template 2: the word is 'you'
feature template 3: the information is - the left son of 'love' is 'I'
这是否意味着我必须使用 LIBLINEAR 定义功能,例如:-------FORMAT 1 (词汇索引:0-I,1-love,2-you)
LABEL ATTR1(template1) ATTR2(template2) ATTR3(template3)
----- ----- ----- -----
SHIFT 1 2 0
(or LEFT-arc,
RIGHT-arc)
但是我已经想到了其他人的一些陈述,我似乎用二进制定义了特征,所以我必须定义一个单词向量,例如: ('I', 'love', 'you'),例如出现'you'时,向量将是(0, 0, 1)
所以LIBLINEAR中的特征可能是:--------FORMAT 2
LABEL ATTR1('I') ATTR2('love') ATTR3('love')
----- ----- ----- -----
SHIFT 0 1 0 ->denoting the feature template 1
(or LEFT-arc,
RIGHT-arc)
SHIFT 0 0 1 ->denoting the feature template 2
(or LEFT-arc,
RIGHT-arc)
SHIFT 1 0 0 ->denoting the feature template 3
(or LEFT-arc,
RIGHT-arc)
FORMAT 1 和 2 哪个正确?
是不是我记错了什么?
【问题讨论】:
-
特征模板 1 与模板 2 有何不同?
-
你知道,基于转换的依赖解析中使用了栈和队列。所以模板 1 和 2 是不同的......
-
我不明白为什么选择这两个选项可能很重要。你能澄清一下吗?
-
@Daniel:是的,这两个选项的内容是一样的,只是格式不同。实际上,我只是问如何在我的解析问题中使用 LIBLINEAR。
-
在我看来,您必须开发您的
feature_extractor组件,它将生成正确的数据文件以传递给 LIBLINEAR。但我不确定我是否明白了你的问题。
标签: machine-learning nlp libsvm text-mining liblinear