File tree 1 file changed +7
-5
lines changed
machine_learning/neural_networks
1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 1
1
"""
2
2
Convolutional Neural Network (CNN) for MNIST Classification
3
3
4
- Goal: This script builds a deep CNN to classify the MNIST dataset using TensorFlow and Keras. It leverages
5
- convolutional layers for feature extraction and pooling layers for down-sampling, followed by fully connected layers
6
- for classification.
4
+ Goal: This script builds a deep CNN to classify the MNIST dataset using
5
+ TensorFlow and Keras. It leverages convolutional layers for feature
6
+ extraction and pooling layers for down-sampling, followed by fully
7
+ connected layers for classification.
7
8
8
9
Objectives:
9
10
- Load and preprocess MNIST data (reshape for CNN input).
12
13
13
14
"""
14
15
15
- import tensorflow as tf
16
+ # import tensorflow as tf
16
17
from tensorflow .keras import layers , models
17
18
from tensorflow .keras .datasets import mnist
18
19
from tensorflow .keras .utils import to_categorical
56
57
model .add (layers .Dense (10 , activation = "softmax" ))
57
58
58
59
# Compile the model
59
- model .compile (optimizer = "adam" , loss = "categorical_crossentropy" , metrics = ["accuracy" ])
60
+ model .compile (optimizer = "adam" , loss = "categorical_crossentropy" ,
61
+ metrics = ["accuracy" ])
60
62
61
63
# Display the model summary
62
64
model .summary ()
You can’t perform that action at this time.
0 commit comments