-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
31 lines (24 loc) · 884 Bytes
/
Copy pathmain.py
File metadata and controls
31 lines (24 loc) · 884 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from model import *
from keras.datasets import mnist
from dataReformatting import *
from training import *
#Loading in data
(train_images, train_labels), (test_images, test_labels) = mnist.load_data()
train_labels = convertToClassificationMatrix(train_labels)
test_labels = convertToClassificationMatrix(test_labels)
trainData, testData = reformatData(train_images, test_images, 60000, 10000)
#Initialize Model and Layer Objects
model = Model()
layer1 = InputLayer(784)
layer2 = Layer(512, "relu", layer1)
layer3 = Layer(10, "softmax", layer2)
#Add layer objects to the model
model.addLayer(layer1)
model.addLayer(layer2)
model.addLayer(layer3)
#Test the model before training
testModel(model, testData, test_labels)
#Train model
trainModel(model, trainData, train_labels, 0.0001, 3)
#Test model after training to see effect of training
testModel(model, testData, test_labels)