The lab assignments in this course are implemented in the Python programming language. The training of filters and neural networks is done with he automatic differentiation tools provided by the Pytorch library. And when using graph neural architectures we use the Alelab Graph Neural Network Library. This page contains installation instructions for these three tools.
Python Programming Language
For those that have not used Python before, we recommend reading/completing a few tutorials on Python to get familiarized with the language. Here is a list of a few such resources:
• https://www.w3schools.com/python/python_intro.asp
• https://www.learnpython.org/
• https://www.udemy.com/pythonforbeginnersintro/
After you become familiar with Python, you also need to take a look at its numerical calculus features. Please refer to this Numpy tutorial.
Installing Python in Linux
If you are a Linux user, we recommend that you use the Anaconda distribution of Python. To install Anaconda, follow these steps:
(1) Visit the Anaconda download page. Select Linux as your operating system and download the distribution.
(2) Follow these steps to install the Anaconda Linux distribution. That’s it. Some more information to get started can be found in this link.
Installing Python in Windows
If you are a Windows user we also recommend the Anaconda distribution of Python. To install Anaconda in Windows follow these steps:
(1) Visit the Anaconda download page. Select Windows as your operating system and download the file with extension .exe corresponding to the installer for the most recent Python 3 release.
(2) Open and run the installer. That’s it.
(3) To check that your installation is correct, copy the command below into a .txt file and save it as helloWorld.py
print("Hello World!")
(4) Open the Anaconda prompt and run
python3 helloWorld.py
(5) If you like using IDEs, Spyder is a good option. The following command line installs Spyder in a dedicated environment, spyder-env, to update it separately from your other packages and avoid any conflicts. On the Anaconda prompt, type
conda create -n spyder-env spyder=4 numpy scipy pandas matplotlib sympy cython
(6) Every time you want to start Spyder, simply type
activate spyder-env spyder
Pytorch Machine Learning Library
After you become familiar with Python and Numpy, you may choose to study Pytorch. We recommend this PyTorch tutorial on training an image classifier. You don’t have to do this, though. We will cover the use of Pytorch in Lab 1 and Lab 2. But try installing it now. To get it out of the way.
Installing Pytorch in Linux
These instructions assume you have successfully installed the Anaconda Python distribution for Linux. If you have done that, follow these steps to install the Pytorch machine learning library:
(1) Use Anaconda to install PyTorch as explained in this page.
(2) Open a text editor and type the following code:
import torch print("All set")
(3) Save the file as Test.py
(4) Open a virtual environment in Anaconda. Navigate to the location where you saved Test.py and type:
python Test.py
(5) You are all set if the code prints
All set
Installing Pytorch in Windows
These instructions assume you have successfully installed the Anaconda Python distribution for Windows. If you have done that, you install the Pytorch machine learning library with the following command:
Activate your environment and run
activate spyder-env conda install pytorch torchvision cpuonly -c pytorch
Alelab Graph Neural Network Library
When the time comes for us to run graph neural networks, we will use the library available in the Alelab GitHub. This PyTorch library was developed by Fernando Gama.
You can follow the instructions provided to install the software now. However, we recommend that you wait until we tackle Lab 3. The reason is that while you could download the library now, you have no way of knowing if it has been successfully installed.