Regularisation for regression problems

I have tried to make the necessary changes for regularisation in the “0417_OverfittingAndRegularisation-1555486774539” notebook for regression problems.

Kindly update the necessary changes as I am still getting some errors.

  self.layer_sizes = [2, num_hidden, 3]

In code above, layer_sizes is a list with 3 elements with valid index {0, 1, 2}

 for i in range(1,self.num_layers+1):

But in code above, since num_layers=3 for loop runs with i(index) taking {0, 1, 2, 3}. Note i=3 is not a valid index for layer_sizes[i]. layer_sizes[3] will throw index out of range error.

num_layers = 2 will fix it (if it suits your rest of the program).

For this configuration I have modified the code.

the underlined parameters in figure 2 is confusing. Please tell what these variables are??

num_hidden is the number of neurons in the hidden layer. This is mentioned at about 45sec into the video. See screenshot below.
So only changing the values of `num_hidden’ won’t increase the number of hidden layers in your code.
This notebook deals with only one hidden layers (and different values for neuron) while your requirement is for multiple layers.

1 Like

I think book keeping issues are the errors.

Kindly, suggest improvements.

You are assigning value returned from get_accuracy( ) function call, but the function definition doesn’t contain any return statement.