In [1]:
import numpy as np
import matplotlib.pyplot as plt
from sgd_utils import *
# for auto-reloading extenrnal modules
# see http://stackoverflow.com/questions/1907993/autoreload-of-modules-in-ipython
%load_ext autoreload
%autoreload 2
In [4]:
train_set_x_orig, train_set_y_orig, test_set_x_orig, test_set_y_orig = load_data()
X = (train_set_x_orig.reshape(train_set_x_orig.shape[0], -1) / 255.).T
Y = (train_set_y_orig.reshape(train_set_y_orig.shape[0], 1)).T
X_test = (test_set_x_orig.reshape(test_set_x_orig.shape[0], -1) / 255.).T
Y_test = (test_set_y_orig.reshape(test_set_y_orig.shape[0], 1)).T
print('X shape: ', X.shape)
print('Y shape: ', Y.shape)
print('X_test shape: ', X_test.shape)
print('Y_test shape: ', Y_test.shape)
In [5]:
layer_dims = [X.shape[0], 5, 3, 1]
parameters = model(X, Y, layer_dims, None, learning_rate = 0.0075)
In [6]:
layer_dims = [X.shape[0], 5, 3, 1]
parameters = model(X, Y, layer_dims, 'momentum', learning_rate = 0.0075)
In [3]:
layer_dims = [X.shape[0], 5, 3, 1]
parameters = model(X, Y, layer_dims, 'adam', learning_rate = 0.0075)
In [ ]:
layer_dims = [X.shape[0], 5, 3, 1]
parameters = model_with_batch_norm(X, Y, layer_dims, learning_rate = 0.0075)
In [ ]: