/mlrefined

Python and MATLAB code examples and demos from the textbook "Machine Learning Refined" (Cambridge University Press)

Primary LanguageJupyter Notebook

Machine Learning Refined demo code examples

In this repository you can find demo code written in Python and MATLAB for Chapters 2 - 8 from the textbook Machine Learning Refined. You can download this chapter by visiting www.mlrefined.com

Current code demos include:

Chapter 2 demos on gradient descent and Newton's method

Below is a video tutorial illustrating how gradient descent works via use of the demo code (convex_grad_surrogate and nonconvex_grad_surrogate, which you may find here) - these illustrate the basic concepts underlying gradient descent applied to minimizing both convex and nonconvex functions. Some principles from the chapter are briefly described before jumping into the code.

Demo Doccou alpha

Below is a video tutorial illustrating how Newton's method works via use of the demo code (convex_newton_surrogate and nonconvex_newton_surrogate, which you may find here) - these illustrate the basic concepts underlying Newton's method applied to minimizing both convex and nonconvex functions. Some principles from the chapter are briefly described before jumping into the code.

Demo Doccou alpha

Chapter 3 demos on regression and L2 regularization

Below is a video tutorial illustrating how L2 regularization convexifies nonconvex cost functions, thereby making minimization of such functions easier. The code (l2reg_logistic, which you may find here) shows the result of applying L2 regularization to a nonconvex form of logistic regression on a simple dataset, as well as the resulting convexificaation of this cost function due to regularization. Again, some principles from the chapter - which is available for download at www.mlrefined.com - are briefly described before jumping into the code.

Demo Doccou alpha

Simple linear regression on an important dataset

alt tag

Chapter 4 demos on two class logistic regression and support vector machines, as well as multi-class one-versus-all and multiclass softmax / logistic regression

Two class classification with logistic regression:

alt tag

Multiclass classification with One-versus-All classification

alt tag