pythonneural-networkpycharmpython-3.10

Code in mnielson book on neural networks not working


I am learning neural networks from the book http://neuralnetworksanddeeplearning.com/chap1.html and I have created the code, making sure to use the up to date version for python 3.10 from github, and I am encountering an error when I try to run this bit of code in python shell: Here is the code I am trying to run.

The error is as follows:

error message

does anyone know why this is, or how to fix it? I am running this in pycharm in python 3.10


Solution

  • It looks like the issue is related to copy pasting the commands from the book into the python shell. The easiest way would be to run it if you bring the second line into one line:

    So from:

    training_data, validation_data, test_data = \
    ... mnist_loader.load_data_wrapper()
    

    To this:

    training_data, validation_data, test_data = mnist_loader.load_data_wrapper()
    

    Give it a try!

    EDIT: The other way should be to remove the extra three dots you have in the shell there, when the line is broken using \

    EDIT2: For the FileNotFound exception, paste the file called mnist.pkl.gz into a data/ directory two levels up your working directory. Your folder structure needs to match what you see in the github repo to be able to run it.