This is a short regression tutorial that is meant to show the differences of implementing a linear regression and a 2-layer neural network regressor in Theano and PyTorch. To start off it also uses their implementation in Scikit-Learn.
The whole code is in a single py file which is segmented into cells using Spyder specifications, i.e. to get the most out of it - it is meant to be run cell by cell in Spyder.
The code is based on various other regression tutorials including:
-
PyTorch-Tutorial : 301_regression by Morvan Zhou - cool plotting take from here
The code is divided in four main sections:
- Scikit-learn
- Theano
- PyTorch
- PyTorch - full bells and whistles
- Bonus: PyTorch for GPU matrix computations
Here are the plots obtained for PyTorch: