Using the error function, we know whether we should update our line in order to generate the line of best fit or not, but how to update the line is what we are going to see in this section. How will we minimize this error and generate the line of best fit? So to answer this question, first of all, let's get some basic understanding about gradient descent and the coding part, where we are just left with our one last function, gradient_descent_runner(). Refer to Figure 9.23:
Calculating gradient descent
Figure 9.23: A 3D graph for understanding gradient descent (Image credit: https://spin.atomicobject.com/wp-content/uploads/gradient_descent_error_surface.png) ...
Get Python Natural Language Processing 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.