Skip to content

Commit

Permalink
optimizer hotfix for FileService writing to correct subset
Browse files Browse the repository at this point in the history
  • Loading branch information
mbeissinger committed Dec 7, 2015
1 parent 9d8f6c3 commit 9da5602
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions opendeep/models/single_layer/tests/lenet.py
Expand Up @@ -7,7 +7,7 @@
from opendeep.data import ModifyStream
from opendeep.models import Prototype, Conv2D, Dense, Softmax
from opendeep.models.utils import Pool2D, Flatten
from opendeep.monitor import Monitor
from opendeep.monitor import Monitor, FileService
from opendeep.optimization.loss import Neg_LL
from opendeep.optimization import SGD
from opendeep.data import MNIST
Expand Down Expand Up @@ -72,13 +72,13 @@ def build_lenet():
# targets from MNIST are int64 numbers 0-9
y = lvector('y')
loss = Neg_LL(inputs=lenet.get_outputs(), targets=y, one_hot=False)
error_monitor = Monitor(name='error', expression=mean(neq(lenet.models[-1].y_pred, y)), valid=True, test=True)
error_monitor = Monitor(name='error', expression=mean(neq(lenet.models[-1].y_pred, y)), valid=True, test=True, out_service=FileService('outputs/lenet_error.txt'))
# optimize our model to minimize loss given the dataset using SGD
optimizer = SGD(model=lenet,
dataset=data,
loss=loss,
epochs=200,
batch_size=500,
batch_size=128,
learning_rate=.1,
momentum=False)
optimizer.train(monitor_channels=error_monitor)
2 changes: 1 addition & 1 deletion opendeep/optimization/optimizer.py
Expand Up @@ -541,7 +541,7 @@ def _compute_over_subset(self, subset, inputs, targets,
# send the values to their outservices
for name, service in monitors_outservice_dict.items():
if name in current_mean_monitors and service:
service.write(current_mean_monitors[name], "test")
service.write(current_mean_monitors[name], subset)
# if there is a plot, also send them over!
if plot:
plot.update_plots(epoch=self.epoch_counter, monitors=current_mean_monitors)
Expand Down

0 comments on commit 9da5602

Please sign in to comment.