Tales of Machine Learning #3: “Home Recipes”

Hello and welcome to part 3 of my Tales of Machine Learning, where I detail my journey to explore Supervised Learning and Neural Networks (NNs).

This time, I’d like to talk about the journey after finishing my online nanodegree program. For anyone who didn’t know about my nanodegree, click here to learn about it!

For Context…

While I was taking my nanodegree, I coded all of my NNs on a software called Jupyter. There, I could write my code in command-line executable “.py” files or in Jupyter Notebooks (“.ipynb”), where I could write code in blocks or “cells”. The environment that I worked in were provided by the Udacity program, itself. Therefore, all necessary python packages like PyTorch, Torchvision, and Pandas were already installed. This allowed me to focus on writing the code and not worry about administrative processes and installations.

By this point, I had installed Anaconda, an IDE that allows me to run python and other software like Jupyter Notebook. It is free and opensource, so it is perfect for designing public opensource learning modules for GearsNGenes courses. Since I already had Jupyter Notebook with me, I decided that I should download the code and run it on my own notebook, locally.

The Challenge…

Once I downloaded the files from my nanodegree, I tried to run a basic example that classified pictures of numbers (from the MNIST database). Pytorch is the library that would allow me to construct a neural network that could perform such a task. However, the compiler returned an error saying that the PyTorch package was not defined. At first, this did not seem like a big issue. Looking at Anaconda’s list of Python packages, I noticed that I had not yet installed PyTorch.

After I installed PyTorch on Anaconda and restarted Jupyter Notebook, I was ready to see my neural network begin to train. However, once again, I got an error saying PyTorch was still not installed. I went into the settings of Jupyter to make sure that PyTorch was registered and marked as activated. This had stumped me because now that I knew that PyTorch was installed, I had no idea why it wasn’t being acknowledged.

My Solution…

When I then noticed that other libraries I had installed and successfully tested were also failing to be registered, I knew something was up. However, I didn’t know what, exactly. I decided I would start from scratch by reestablishing my Anaconda software.

First, I uninstalled Anaconda from my computer and installed the newest version.

Next, I installed all the libraries I used for my basic MNIST database code: NumPy, Pandas, PyTorch, Torchvision, and MatPlotLib.

Then, I tested each package by importing them in Anaconda’s Python environment.

When each import executed without an error, I reexamined my NN code. There were some syntactical errors in the code after compiling it, but none that I couldn’t debug. But with that final sweep of corrections, my NN was working! It was successfully classifying pictures of digits with high accuracy.

What to Take Away…

Ultimately, the challenge lied in knowing that my Anaconda installation, at some point, had been corrupted. Although I still don’t know how and why, I wanted to tell this story. That is because sometimes when you are struggling with a problem that seems to arise from nowhere, it helps to look back at earlier steps in your process and retry them, because they might help reveal source of your issues.

Thanks For Reading!

Thank you for reading. To see the previous or next post in my “Tales of Machine Learning” series, use the text directly below to navigate.

Previous|Next

Until next time, keep building and stay creative!

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top