Skip to content

Commit 63be3d9

Browse files
committed
fixed batch training
1 parent 5140020 commit 63be3d9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

tagger.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def train(self, file_in, file_out, max_iterations, top_x, decrease_alpha, shuffl
101101
# batch training:
102102
predictions = {}
103103
for tag in classifiers:
104-
predictions[tag] = classifiers[tag].weight_vector
104+
predictions[tag] = [x for x in classifiers[tag].weight_vector]
105105
print "\t\tEpoch " + str(i) + ", alpha = " + str(alpha)
106106
for ind, t in enumerate(tokens):
107107
if ind % (len(tokens) / 10) == 0 and not ind == 0:
@@ -133,7 +133,7 @@ def train(self, file_in, file_out, max_iterations, top_x, decrease_alpha, shuffl
133133
# apply batch results to weight vectors:
134134
if batch_training:
135135
for tag in classifiers:
136-
classifiers[tag].weight_vector = predictions[tag]
136+
classifiers[tag].weight_vector = [x for x in predictions[tag]]
137137

138138
# decrease alpha
139139
if decrease_alpha:

0 commit comments

Comments
 (0)