# C1\_W2\_assignment\_accuracy

**URL:** <https://community.deeplearning.ai/t/c1-w2-assignment-accuracy/428813>\
**Category:** Introduction to TF for Artificial Intelligence ...\
**Tags:** week-module-2\
**Created:** [August 26, 2023, 2:39pm UTC](https://community.deeplearning.ai/t/c1-w2-assignment-accuracy/428813 "2023-08-26T14:39:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Basira\_Daqiq](https://avatars.discourse-cdn.com/v4/letter/b/8491ac/32.png) [@Basira\_Daqiq](https://community.deeplearning.ai/u/Basira_Daqiq)\
**Post date:** [August 26, 2023, 2:39pm UTC](https://community.deeplearning.ai/t/c1-w2-assignment-accuracy/428813/1 "2023-08-26T14:39:05Z")

</div>

I have defined my callback with accuracy, but I don’t understand why is the accuracy going down over epochs

 ![Screenshot 2023-08-26 at 7.35.34 AM](https://global.discourse-cdn.com/dlai/original/3X/6/2/6226bfc122adea842feecb7117f412e93269b86a.png)

---

<div class="post-metadata">

**Author:** ![Deepti\_Prasad](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/deepti_prasad/32/165831_2.png) [@Deepti\_Prasad](https://community.deeplearning.ai/u/Deepti_Prasad)\
**Post date:** [August 26, 2023, 4:04pm UTC](https://community.deeplearning.ai/t/c1-w2-assignment-accuracy/428813/2 "2023-08-26T16:04:29Z")

</div>

what input shape you have used?

go back and check your callback codes, on\_epoch end and same shape as you got for data\_shape.

Hope you have used Flatten layer with the input shape and another 2 dense layer.

---

<div class="post-metadata">

**Author:** ![Basira\_Daqiq](https://avatars.discourse-cdn.com/v4/letter/b/8491ac/32.png) [@Basira\_Daqiq](https://community.deeplearning.ai/u/Basira_Daqiq)\
**Post date:** [August 26, 2023, 4:27pm UTC](https://community.deeplearning.ai/t/c1-w2-assignment-accuracy/428813/3 "2023-08-26T16:27:14Z")

</div>

I first use a flattened layer, input\_shape=(28, 28), then three Dense layers. First dense layer 510 units, second 250 units, both with relu activation. Third Dense layer with 10 units and linear activation. i did not pass input-shape to any of the layers.

I passed on tf.keras.callbacks.Callback into the myCallback class, and self, epochs , logs= {} to the on\_epock\_end function, and set the self.model.stop\_training to True

---

<div class="post-metadata">

**Author:** ![Basira\_Daqiq](https://avatars.discourse-cdn.com/v4/letter/b/8491ac/32.png) [@Basira\_Daqiq](https://community.deeplearning.ai/u/Basira_Daqiq)\
**Post date:** [August 26, 2023, 4:49pm UTC](https://community.deeplearning.ai/t/c1-w2-assignment-accuracy/428813/4 "2023-08-26T16:49:14Z")

</div>

Resolved!

I should have used Softmax activation to get labels rather than probabilities with linear function
