# Neural Networks – 2016/2017

Older editions: 2012 – 2013/2014

**Overview**

This page contains the material for the lab sessions that I held in the Neural Networks course taught by Prof. Aurelio Uncini for the M.Sc. in Artificial Intelligence and Robotics. For general informations about the course please refer to the original web pages.

## Prerequisites

All lab sessions require a working installation of Python 3.5 with (at least) **NumPy**, **matplotlib**, and **scikit-learn** (for the second and third labs). If you are starting from scratch, installing the Anaconda platform is the recommended method to have a working installation with all prerequisites. Alternatively, Canopy offers a working license by registering with the academic email. If you prefer a minimal installation, after installing Python and the pip module to manage libraries (e.g., following this guide on Ubuntu systems), you can install all prerequisites by running the following command on the console:

1 |
pip install numpy matplotlib sklearn |

## Lab session 1 – NumPy and linear regression

Download the code for this lab

This lab session aims at gaining some familiarity with NumPy (for linear algebra), and the basic workflow of a machine learning application. Specifically, we aim at approximating a sinusoid function starting from some values sampled with error:

where the error ε follows a Gaussian distribution with fixed variance. This is obtained by fitting a linear model on the space built by taking polynomial features of up to a given power :

You are encouraged to experiment what happens when varying the number of sampled values, the amount of regularization and the number of power expansions, thus obtaining different levels of underfitting/overfitting.

## Lab session 2 – scikit-learn

Download the code for this lab

This lab is intended to provide some familiarity with the objects in scikit-learn. The code goes through an entire workflow applied to a classification problem, including data normalization, data splitting, model fine-tuning, and evaluation. The lab requires version 0.18.1 of scikit-learn, where neural networks and the module ‘model_selection’ were introduced (see the release history). If you have a previous version of scikit-learn, you can upgrade by running the following command on the console:

1 |
pip install --upgrade sklearn |

## Lab session 3 – Theano and Lasagne

Download the code for this lab

This lab introduces the Theano and Lasagne libraries. For details on the installation of Theano, please refer to the official installation guides:

http://deeplearning.net/software/theano_versions/dev/install.html

On Windows with Anaconda, a basic installation (withouth CUDA support for the GPU) requires the following commands:

1 2 |
pip install theano==0.8.2 conda install mingw libpython |

On all platforms, Lasagne can be installed immediately using pip:

1 |
pip install lasagne |

## Leave a Reply