Skip to content

Commit

Permalink
fixed batch training
Browse files Browse the repository at this point in the history
  • Loading branch information
wittmamz committed Aug 9, 2015
1 parent 5140020 commit 63be3d9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def train(self, file_in, file_out, max_iterations, top_x, decrease_alpha, shuffl
# batch training:
predictions = {}
for tag in classifiers:
predictions[tag] = classifiers[tag].weight_vector
predictions[tag] = [x for x in classifiers[tag].weight_vector]
print "\t\tEpoch " + str(i) + ", alpha = " + str(alpha)
for ind, t in enumerate(tokens):
if ind % (len(tokens) / 10) == 0 and not ind == 0:
Expand Down Expand Up @@ -133,7 +133,7 @@ def train(self, file_in, file_out, max_iterations, top_x, decrease_alpha, shuffl
# apply batch results to weight vectors:
if batch_training:
for tag in classifiers:
classifiers[tag].weight_vector = predictions[tag]
classifiers[tag].weight_vector = [x for x in predictions[tag]]

# decrease alpha
if decrease_alpha:
Expand Down

0 comments on commit 63be3d9

Please sign in to comment.