Learning From Data - Homework 5 - A solution in LIONoso
Courtesy of Giovanni Pellegrini
We provide a solution to exercise 7, about Gradient Descent.
Before proceeding, be sure to have Python installed on your computer.
Connecting the Gradient Descent Python script to LIONoso
You can download the Gradient Descent Algorithm script ,
containing our solution
to the exercise.
Please read the notes for Windows users
if you are using this operating system.
Load the script by dragging a Parametric
table element into the workbench, and by specifying the filename of your script.
In the above figure we just loaded the script (Exercise7-Gradient.py).
Then you can specify the number of iterations, the learning rate of the algorithm and the initial values of u and v.
By clicking the "Compute" button, the script is launched and a table containing the results of each experiment
The table contains the iterations, the Error and the values of v and u.
To compute the average of the Error
open a Bubblechart from the output table (right click on the table generated, select "New panel"->"Bubble") and
drag the "Error" column
onto the y axis. Select the "Advanced properties" tab in the left panel and select "Show polynomial fit" with 0 degree.
A red line will appear on the plot showing the average value.
The result with default values (30 Iterations, 0.1 learning rate, v = 1 and u = 1) are:
After 30 iteration: 0.07