Skip to content

Commit

Permalink
Chapter 4 - vanishing gradient problem in a deep networks
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalDanielDobrzanski committed Sep 13, 2016
1 parent 7283525 commit 092007f
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions test.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""
Testing code for different neural network configurations.
Adapted for Python 3.4.3
Adapted for Python 3.5.2
Usage in shell:
python3 test.py
python3.5 test.py
Network (network.py and network2.py) parameters:
2nd param is epochs count
Expand Down Expand Up @@ -64,12 +64,6 @@
monitor_training_accuracy=True)
'''

net = network2.Network([784, 30, 10], cost=network2.CrossEntropyCost)
net.SGD(training_data[:1000], 30, 10, 0.5,
lmbda=5.0,
evaluation_data=validation_data,
monitor_evaluation_accuracy=True)

# chapter 3 - Early stopping implemented
'''
net = network2.Network([784, 30, 10], cost=network2.CrossEntropyCost)
Expand All @@ -81,6 +75,16 @@
early_stopping_n=10)
'''

# chapter 4 - The vanishing gradient problem - deep networks are hard to train with simple SGD algorithm
# this network learns much slower than a shallow one.
net = network2.Network([784, 30, 30, 30, 30, 10], cost=network2.CrossEntropyCost)
net.SGD(training_data, 30, 10, 0.1,
lmbda=5.0,
evaluation_data=validation_data,
monitor_evaluation_accuracy=True)



# ----------------------
# - network3.py example:
import network3
Expand Down

0 comments on commit 092007f

Please sign in to comment.