Skip to content

Commit 9c58858

Browse files
Add examples of configurations to try.
1 parent 6ac6be1 commit 9c58858

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

examples/mnist.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,38 @@ def train(net, train_data):
5656

5757

5858
if __name__ == "__main__":
59+
# First configuration we tried.
5960
layers = [
6061
Layer(784, 16, LeakyReLU()),
6162
Layer(16, 16, LeakyReLU()),
6263
Layer(16, 10, LeakyReLU()),
6364
]
6465
net = NeuralNetwork(layers, MSELoss(), 0.001)
6566

67+
# # Use a Sigmoid as the final layer (don't forget to import it!)
68+
# layers = [
69+
# Layer(784, 16, LeakyReLU()),
70+
# Layer(16, 16, LeakyReLU()),
71+
# Layer(16, 10, Sigmoid()),
72+
# ]
73+
# net = NeuralNetwork(layers, MSELoss(), 0.001)
74+
75+
# # Use Sigmoid at the end and CrossEntropyLoss (import them!)
76+
# layers = [
77+
# Layer(784, 16, LeakyReLU()),
78+
# Layer(16, 16, LeakyReLU()),
79+
# Layer(16, 10, Sigmoid()),
80+
# ]
81+
# net = NeuralNetwork(layers, CrossEntropyLoss(), 0.001)
82+
83+
# # Only LeakyReLU's and the CrossEntropyLoss (import the loss!)
84+
# layers = [
85+
# Layer(784, 16, LeakyReLU()),
86+
# Layer(16, 16, LeakyReLU()),
87+
# Layer(16, 10, Sigmoid()),
88+
# ]
89+
# net = NeuralNetwork(layers, CrossEntropyLoss(), 0.001)
90+
6691
test_data = load_data(TEST_FILE, delimiter=",", dtype=int)
6792
accuracy = test(net, test_data)
6893
print(f"Accuracy is {100*accuracy:.2f}%") # Expected to be around 10%

0 commit comments

Comments
 (0)