/PyRegression

Regression tutorial in scikit-learn theano pytorch

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

PyRegression

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:

  1. "Linear Regression Example" by Jaques Grobler

  2. "A Real Example: Logistic Regression" in Theano Tutorial

  3. "Learning PyTorch with Examples" by Justin Johnson

  4. PyTorch-Tutorial : 301_regression by Morvan Zhou - cool plotting take from here

The code is divided in four main sections:

  1. Scikit-learn
  2. Theano
  3. PyTorch
  4. PyTorch - full bells and whistles
  5. Bonus: PyTorch for GPU matrix computations

Here are the plots obtained for PyTorch:

alt text