Skip to content

Commit 13d2821

Browse files
committed
fixed batch training
1 parent 5f4709f commit 13d2821

File tree

6 files changed

+39990
-2
lines changed

6 files changed

+39990
-2
lines changed

named-entity-recognizer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def train(self, file_in, file_out, max_iterations, top_x, decrease_alpha, shuffl
133133
# batch training:
134134
predictions = {}
135135
for tag in classifiers:
136-
predictions[tag] = classifiers[tag].weight_vector
136+
predictions[tag] = [x for x in classifiers[tag].weight_vector]
137137
print "\t\tEpoch " + str(i) + ", alpha = " + str(alpha)
138138
path = []
139139
normalization_constant = 10.0 ** 5.0
@@ -253,7 +253,7 @@ def train(self, file_in, file_out, max_iterations, top_x, decrease_alpha, shuffl
253253
# apply batch results to weight vectors:
254254
if batch_training:
255255
for tag in classifiers:
256-
classifiers[tag].weight_vector = predictions[tag]
256+
classifiers[tag].weight_vector = [x for x in predictions[tag]]
257257

258258
# decrease alpha
259259
if decrease_alpha:

0 commit comments

Comments
 (0)