저는 Vowpal Wabbit의 Python API를 사용하여 명명 된 엔티티 인식 분류자를 훈련시켜 짧은 이름의 사람, 조직 및 위치를 탐지합니다. 데이터에 대한 세부 정보, 모델 교육 방법 및 평가 문장에서 식별 된 엔터티를 사용하여 IPython Notebook을 작성했습니다. 교육 데이터는 ATIS 및 CONLL 2003 데이터 세트에서 제공됩니다.Vowpal Wabbit을 사용한 명명 된 엔티티 인식이 훈련 데이터를 암시하는 것으로 나타납니다.
(this tutorial 기준) 내 Vowpal Wabbit SearchTask 클래스의 설정 :
class SequenceLabeler(pyvw.SearchTask):
def __init__(self, vw, sch, num_actions):
pyvw.SearchTask.__init__(self, vw, sch, num_actions)
sch.set_options(sch.AUTO_HAMMING_LOSS | sch.AUTO_CONDITION_FEATURES)
def _run(self, sentence):
output = []
for n in range(len(sentence)):
pos,word = sentence[n]
with self.vw.example({'w': [word]}) as ex:
pred = self.sch.predict(examples=ex, my_tag=n+1, oracle=pos, condition=[(n,'p'), (n-1, 'q')])
output.append(pred)
return output
모델 교육 :
vw = pyvw.vw(search=num_labels, search_task='hook', ring_size=1024)
#num_labels = 3 ('B'eginning entity, 'I'nside entity, 'O'ther)
sequenceLabeler = vw.init_search_task(SequenceLabeler)
sequenceLabeler.learn(training_set)
모델은 (정확한 문자열 일치)가 존재라는 단체에서 잘 수행 데이터를 학습하지만, 동일한 구조를 사용하는 새로운 예제로는 일반적으로 불충분하다. 즉, 분류자는 트레이닝 데이터의 문장에있는 엔티티를 식별하지만 이름 만 변경하면 제대로 수행되지 않습니다.
sample_sentences = ['new york to las vegas on sunday afternoon',
'chennai to mumbai on sunday afternoon',
'lima to ascuncion on sunday afternoon']
분류 실행이의 출력 : '일요일 오후에 b
에 a
'모델이 새로운 위치를 식별 할 수 없습니다
new york to las vegas on sunday afternoon
locations - ['new york', 'las vegas']
chennai to mumbai on sunday afternoon
locations - []
lima to ascuncion on sunday afternoon
locations - []
이 문장은 동일하게 유지하더라도 것을 나타냅니다를 아마도 훈련 예를 암기했기 때문일까?
비슷한 결과는 organisation
및 person
분류 자에 적용됩니다. 이것들은 내 Github에서 찾을 수 있습니다.
내 질문이 있습니다 -
- 내가 잘못 여기서 뭐하는 거지?
- 모델에 따라 달라질 수있는 다른 매개 변수가 있습니까? 또는
ring_size
및search_task
과 같은 기존의 것을 더 잘 사용할 수 있습니까? - 모델의 일반성을 향상시키기 위해 제안 할 수있는 제안이 있습니까? 도움을 줄 수있는 유일한 기능은 한 음절하고 ID를 음절 수 있도록