How to post in this category:
{ASSIGNMENT NOTEBOOK REMOVED BY MODERATOR AS IT IS AGAINST CODE OF CONDUCT}
I am enrolled in the course Introduction to Tensorflow for AI, Machine learning and Deeplearning. I have completed all my assignments and got stuck with Week 3 Assignment. The data set given is mnist.npz. I am getting below error
—> history = model.fit(training_images, training_labels, epochs=10, callbacks=[callbacks])
AttributeError: ‘function’ object has no attribute ‘fit’
AttributeError: ‘function’ object has no attribute ‘count_params’
As per my understanding, this error is had occurred since the model here is defined as a function and ‘fit’ and ‘count_params’ are not an attribute of a function
can you please help me with this. If I submit the assignment with this error it shows fail.
Please help. I have attached the note book also.
Thanks for the reply. I was not knowing, that we cannot upload the notebook.
I have enrolled for the course: Course “Introduction to TensorFlow for Artificial Intelligence, Machine Learning, and Deep Learning”. I am getting error for my week 3 “Improve MNIST with convolutions” assignment.
In the graded Notebook a convolution_model() is defined as a function within which I created a sequential model with only one convolutional layer. This model shows the results for model.summary(), model.count_params() and model.fit() when I use these attributes of the model within the sequential model function.
However, as required in the graded notebook when I call sequential model function as
model= convolution_model()
and call the required attributes like model.count_params() I get the error
" ‘function’ object has no attribute ‘count_params’"
I have tried multiple combinations to resolve the error but not able to do it.
Below is the screen shot of the error
For grade function reshape and normalise, if you notice
def reshape_and_normalize(images), but you have used train_images to reshape and normalise which is incorrect. Kindly use images.
For grader cell myCallback, incorrect statement for
Stop if threshold is met
IT SHOULD BE print(“\nReached 99.5% accuracy so cancelling training!”)
You also do not require the below code line as the def states the cell for myCallback
Instantiate class
callbacks = myCallback()
3. Remove the below codes from GRADED FUNCTION: convolutional_model
def convolutional_model():
model.summary()
print(model.count_params())
history = model.fit(training_images, training_labels, epochs=10, callbacks=[callbacks])
return convolutional_model
You have edited a non_grader cell where you have added your codes and the codes already give you have has tagged it.
grader-required-cell
Save your untrained model
RECOMMENDATION: Get a fresh copy, then refer your saved copy and write codes only where it is required that is between ###START and END CODE HERE as I can see you have edited some of test cell and can hamper your passing the grader.
Hi Deepti,
Thanks for the suggestions on my code. I have implemented all the changes as per your instructions. I did not get any error also. But still i failed the lab.
Attached is the screenshot of the result and lab file
Please let me know how can i improve my score
Thanks for the support
{Assignment Notebook removed by moderator as it is against code of conduct}
You are not suppose to share assignment notebook on public post threads
It seemed the correction where I gave you direct solution for callback you cleared.
But you have not reshape and normal the images as per instructions and also the convolution model.
So first confirm, did you do correction in a fresh copy or you were trying to edit the same assignment notebook as I had noticed you had done so many editing outside where coding was not required.
Also please follow community guidelines, you tick code of conduct that tells you to not share codes on post thread, or GitHub, or share to anyone else unless asked by mentor for reviewing any mistakes.