Exercise 2 and what's the difference between "adam" and "sgd"

I have 2 queries >>

Q1. Related to assignment for week 2

Error: Can’t compile the student’s code. expected an indented block (student_solution.py, line 10)

The below is my code and yet i am still receiving error on the callback function, the code as follows:

"# GRADED FUNCTION: train_mnist
def train_mnist(history):
class myCallback(tf.keras.callbacks.Callback):

def on_epoch_end(self, epoch, logs={}):
print("\nReached 90% accuracy and now stopping testing!!")

self.model.stop_training = True

mnist = tf.keras.datasets.mnist

(x_train, y_train),(x_test, y_test) = mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0

callbacks = myCallback ()

model = tf.keras.models.Sequential([
    tf.keras.layers.Flatten(input_shape=(28, 28)),
    tf.keras.layers.Dense(700, activation=tf.nn.relu),
    tf.keras.layers.Dense(10, activation=tf.nn.softmax)])


history = model.fit(x_train, y_train, epochs=10, callbacks=[callbacks])

return history.epoch, history.history[‘accuracy’][-1]


Q2- what’s the difference between “adam” and “sgd”


Indentation is part of the syntax in python, right? The if statement you show is not valid syntax: the next line should be indented. If it’s just a question of formatting of your post, then please repost and use the “</>” tool to make sure the code does not get treated as Markdown. Of course there’s also the Honor Code to consider here: we’re not supposed to posting code and saying (in effect) “please fix it for me”, right?

Adam is a particular optimization algorithm. Here’s the TF page about it. SGD is short for “Stochastic Gradient Descent”. These topics were both covered in detail in the DLS specialization Course 2 Week 1.