Created
December 6, 2017 14:14
-
-
Save Tathagatd96/0d3082c0c592eb51eb91cdea5d43b9cc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###Training the model | |
#Run the training function per mini-batches. | |
n_examples = X_train.shape[0] | |
n_batches = n_examples / batch_size | |
epochs=50 | |
for epoch in xrange(epochs): | |
for batch in xrange(n_batches): | |
x_batch = X_train[batch*batch_size: (batch+1) * batch_size] | |
y_batch = y_train[batch*batch_size: (batch+1) * batch_size] | |
train_fn(x_batch, y_batch) # This is where the model gets updated | |
###Testing the model | |
loss, acc = val_fn(X_test, y_test) | |
test_error = 1 - acc | |
print('Test error: %f' % test_error) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment