* whitespace

This commit is contained in:
Matthew Honnibal 2015-06-28 01:29:37 +02:00
parent ed40a8380e
commit 65ac389191

View File

@ -84,7 +84,7 @@ def _merge_sents(sents):
def train(Language, gold_tuples, model_dir, n_iter=15, feat_set=u'basic', def train(Language, gold_tuples, model_dir, n_iter=15, feat_set=u'basic',
seed=0, gold_preproc=False, n_sents=0, corruption_level=0, seed=0, gold_preproc=False, n_sents=0, corruption_level=0,
verbose=False, verbose=False,
eta=0.01, mu=0.9, n_hidden=100, eta=0.01, mu=0.9, nv_hidden=100,
nv_word=10, nv_tag=10, nv_label=10): nv_word=10, nv_tag=10, nv_label=10):
dep_model_dir = path.join(model_dir, 'deps') dep_model_dir = path.join(model_dir, 'deps')
pos_model_dir = path.join(model_dir, 'pos') pos_model_dir = path.join(model_dir, 'pos')
@ -105,7 +105,7 @@ def train(Language, gold_tuples, model_dir, n_iter=15, feat_set=u'basic',
features=feat_set, features=feat_set,
labels=Language.ParserTransitionSystem.get_labels(gold_tuples), labels=Language.ParserTransitionSystem.get_labels(gold_tuples),
vector_lengths=(nv_word, nv_tag, nv_label), vector_lengths=(nv_word, nv_tag, nv_label),
hidden_nodes=n_hidden, hidden_nodes=nv_hidden,
eta=eta, eta=eta,
mu=mu mu=mu
) )
@ -123,7 +123,7 @@ def train(Language, gold_tuples, model_dir, n_iter=15, feat_set=u'basic',
(nv_tag * len(tags)) + \ (nv_tag * len(tags)) + \
(nv_label * len(labels)) (nv_label * len(labels))
print 'Compiling' print 'Compiling'
debug, train_func, predict_func = compile_theano_model(n_classes, n_hidden, debug, train_func, predict_func = compile_theano_model(n_classes, nv_hidden,
n_in, 0.0, 0.0) n_in, 0.0, 0.0)
print 'Done' print 'Done'
return TheanoModel( return TheanoModel(
@ -251,7 +251,7 @@ def main(train_loc, dev_loc, model_dir, n_sents=0, n_iter=15, out_loc="", verbos
gold_train = list(read_json_file(train_loc)) gold_train = list(read_json_file(train_loc))
nlp = train(English, gold_train, model_dir, nlp = train(English, gold_train, model_dir,
feat_set='embed', feat_set='embed',
nv_word=nv_word, nv_tag=nv_tag, nv_label=nv_label, nv_word=nv_word, nv_tag=nv_tag, nv_label=nv_label, nv_hidden=nv_hidden,
gold_preproc=gold_preproc, n_sents=n_sents, gold_preproc=gold_preproc, n_sents=n_sents,
corruption_level=corruption_level, n_iter=n_iter, corruption_level=corruption_level, n_iter=n_iter,
verbose=verbose) verbose=verbose)