w4_w6_loss = 0.0
for _ in range(100):
for i, (features, label) in enumerate(xor_data):
eg = w4.Example(features, gold=label)
w4_loss += w4.train(eg)
eg = w4_w6.Example(features, gold=label)
w4_w6_loss += w4_w6.train(eg)
random.shuffle(xor_data)
// We don"t know that the extra width is better, but it shouldn"t be
// *much* worse
After Change
w4_w6_loss = 0.0
for _ in range(100):
for i, (features, label, costs) in enumerate(or_data):
w4_loss += w4.train([(features, costs)])
w4_w6_loss += w4_w6.train([(features, costs)])
random.shuffle(or_data)
// We don"t know that the extra width is better, but it shouldn"t be
// *much* worse