Linear regression with gradient descent in practice

So now we are working with gradient descent techniques in practice for the first time! The concepts we are now practicing will serve us well during the rest of the book. Let's start by importing the prerequisite library, as always. We will use NumPy for numeric processing, and Seaborn and matplotlib for representation:

import numpy as np
import seaborn as sns
%matplotlib inline
import matplotlib.pyplot as plt
sns.set(style='whitegrid', context='notebook')

The loss function will be the guide for us to know how well we are doing. As we saw in the theoretical section, the least squares method will be used.

You can review the J or loss function definition and properties in the previous sections. ...

Get Machine Learning for Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.