Not able to understand the error O/p is correct and code is also from my side

Can anyone help me in this

Hi again. Please click my name and message your notebook as an attachment.

As far as the 1st error is concerned, I think the grader is broken.
Please remove the line callbacks = ... and fix the misspelling of accuracyuracy in that cell

The 2nd graded section on train_mnist has a lot of mistakes:

  1. Don’t redefine myCallback class inside the function.
  2. x_train and y_train are function parameters. So, don’t load and rescale parameters.
  3. Function should return history according to the starter code. Your implementation does this: return history.epoch,history.history['accuracy'][-1]

Please try again and let me know. If the 1st part of the graded function doesn’t pass, I’ll ask the staff to look at this.

I changed but i am still getting the same error should i again share notebook file

Yes please. Don’t forget to include grader feedback when you message the notebook.

[code removed - moderator]

myCallback()

There was a problem compiling the code from your notebook. Details:
invalid syntax (, line 48)

train_mnist()

There was a problem compiling the code from your notebook. Details:
invalid syntax (, line 48)

Here’s the starter code:

# Load the data

# Get current working directory
current_dir = os.getcwd()

# Append data/mnist.npz to the previous path to get the full path
data_path = os.path.join(current_dir, "data/mnist.npz")

# Discard test set
(x_train, y_train), _ = tf.keras.datasets.mnist.load_data(path=data_path)
        
# Normalize pixel values
x_train = x_train / 255.0

This is your version:

# Load the data
mnist = tf.keras.datasets.mnist
(x_train, y_train),(x_test, y_test) = mnist.load_data()
# Get current working directory
current_dir = os.getcwd()

# Append data/mnist.npz to the previous path to get the full path
data_path = os.path.join(current_dir, "data/mnist.npz")

# Discard test set
mnist = tf.keras.datasets.mnist
(x_train, y_train),(x_test, y_test) = tf.keras.datasets.mnist.load_data(path=data_path)
        
# Normalize pixel values
x_train, x_test = x_train / 255.0, x_test / 255.0

There’s still one more thing. Don’t have this line after defining myCallback
callbacks =

Do not touch places where you aren’t supposed to code.

Please refresh your lab and fill code only where required.
See Refresh your Lab Workspace section here

Next time, message your code and screenshot of grader feedback. Don’t post code in public.

So Is my version is written correctly considering after callback removal ?

is there any problem in quiklab compiler same errors also if only call history not history.epochs and history.history[accuracy][-1] then printed out after less than 9 epochs it means your callback worked as expected is not occur

coursera lab is different from qwiklab. This assignment workspace is hosted on coursera lab.

Sorry. I don’t understand your question.

I was saying that we have to print those epochs numbers right when accuracy reaches 99% and same after changing syntax error line 48

You only have to print this (no need for epoch number):
"\nReached 99% accuracy so cancelling training!"

thanks @balaji.ambresh for helping successfully compiled

now solving third week assg , one thing do u know what to write in this section of cell ?

Pre-processing the data

One important step when dealing with image data is to preprocess the data. During the preprocess step you can apply transformations to the dataset that will be fed into your convolutional neural network.

Here you will apply two transformations to the data:

  • Reshape the data so that it has an extra dimension. The reason for this is that commonly you will use 3-dimensional arrays (without counting the batch dimension) to represent image data. The third dimension represents the color using RGB values. This data might be in black and white format so the third dimension doesn’t really add any additional information for the classification process but it is a good practice regardless.

  • Normalize the pixel values so that these are values between 0 and 1. You can achieve this by dividing every value in the array by the maximum.

Remember that these tensors are of type numpy.ndarray so you can use functions like reshape or divide to complete the reshape_and_normalize function below:

Please create new posts for different assignments. Let’s not mix week 2 and week 3.
You can tag me in the new post as well. Thanks.