* Change defaults for character tagger

This commit is contained in:
Matthew Honnibal 2016-02-22 22:56:33 +01:00
parent 422b33838e
commit 3f12fb4191

View File

@ -73,8 +73,8 @@ cpdef enum:
cdef class TaggerNeuralNet(NeuralNet): cdef class TaggerNeuralNet(NeuralNet):
def __init__(self, n_classes, def __init__(self, n_classes,
depth=1, hidden_width=100, depth=5, hidden_width=50,
words_width=20, shape_width=5, suffix_width=5, tags_width=5, words_width=30, shape_width=20, suffix_width=20, tags_width=20,
learn_rate=0.1): learn_rate=0.1):
input_length = 5 * words_width + 5 * shape_width + 5 * suffix_width + 2 * tags_width input_length = 5 * words_width + 5 * shape_width + 5 * suffix_width + 2 * tags_width
widths = [input_length] + [hidden_width] * depth + [n_classes] widths = [input_length] + [hidden_width] * depth + [n_classes]
@ -125,7 +125,7 @@ cdef class TaggerNeuralNet(NeuralNet):
cdef class CharacterTagger(NeuralNet): cdef class CharacterTagger(NeuralNet):
def __init__(self, n_classes, def __init__(self, n_classes,
depth=5, hidden_width=20, depth=4, hidden_width=50,
chars_width=10, chars_width=10,
words_width=20, shape_width=5, suffix_width=5, tags_width=20, words_width=20, shape_width=5, suffix_width=5, tags_width=20,
learn_rate=0.1): learn_rate=0.1):
@ -274,12 +274,12 @@ cdef class Tagger:
# 'pos', 'templates.json', # 'pos', 'templates.json',
# default=cls.default_templates()) # default=cls.default_templates())
model = TaggerNeuralNet() model = CharacterTagger()
if pkg.has_file('pos', 'model'): if pkg.has_file('pos', 'model'):
model.load(pkg.file_path('pos', 'model')) model.load(pkg.file_path('pos', 'model'))
return cls(vocab, model) return cls(vocab, model)
def __init__(self, Vocab vocab, CharacterTagger model): def __init__(self, Vocab vocab, model):
self.vocab = vocab self.vocab = vocab
self.model = model self.model = model