Question: Problem 1. Load MNIST data and scale it (code provided). Estimate a neural network with: epochs =20, batch_size = 100, and one hidden layer with

Problem 1. Load MNIST data and scale it (code provided). Estimate a neural network with: epochs =20, batch_size = 100, and one hidden layer with 400 neurons. Measure and report validation accuracy and estimation time.

PLEASE DON'T USE RandomizedCV with this assignment, it will not work with TensorFlow.

the given code:

import numpy as np

import os

import random

random.seed(42)

np.random.seed(42)

import tensorflow as tf

def reset_graph(seed=42):

tf.reset_default_graph()

tf.set_random_seed(seed)

np.random.seed(seed)

(X_train, y_train), (X_test, y_test) = tf.keras.datasets.mnist.load_data()

X_train = X_train.astype(np.float32).reshape(-1, 28*28) / 255.0

X_test = X_test.astype(np.float32).reshape(-1, 28*28) / 255.0

y_train = y_train.astype(np.int32)

y_test = y_test.astype(np.int32)

X_valid, X_train = X_train[:5000], X_train[5000:]

y_valid, y_train = y_train[:5000], y_train[5000:]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!