In this lab we will look into the world of deep learning and predict on the Iris flower data set using PyTorch.
Install PyTorch on your local machine (or try out Google Colab).
Have a look at the notebook 4_PyTorch_Example.ipynb
.
- Go through the notebook and try to understand what is going on.
- Make this code run on your machine (or on Google Colab).
- Play around with the code and observe the effects on the accuracy of the test data:
- Introduce a second hidden layer with size 5.
- Change the learning rate to a very low value and a very high value. What is the effect on the training loss?
- Train a smaller or bigger number of epochs.
Make a prediction with the trained network on the data point: [4.9, 3.0, 1.4, 0.2]
.
What are the probabilities for the different classes?
Hint: Since the network outputs raw scores, you need to apply the softmax
function to normalize the network's output to probabilities.
Train a model on the digits dataset and see how accurate you can get (use https://github.com/pabair/ml-kurs-ws21/blob/main/2_Logistische_Regression_Digits.ipynb as template).