Exercise M4.04

When i execute the exercise M4.04 code (also checked solution, i just pulled from github to maker sure i have latest notebooks) i get repeated coefficients for repeated features. results are different than in the course website notebook
local:

website course solution:
image

Hi @miwojc ,

I also did the exercice localy and i did not see difference with the solution on the web site.
The graph and the array of coefficients you are obtained locally should be the result of the Ridge model ( as you can see at the bottom of the solution). Are you sure you did not be confused in your notebook between the 2 models ??

my local results for the linear_regression model :

and for the Ridge one :

1 Like

@miwojc we wanted to point out a numerical issue and it might be that this behaviour is only reproducible in some OS. Are you using Linux? If you are using Linux, then it is a bit surprising and we should look at the low-level library used by SciPy and check differences then.

1 Like

I use JupyterLab and Windows Subsystem for Linux 2 to run the notebooks.

here’s the system information:

powershell:
❯ wsl -l -v
NAME STATE VERSION
* Ubuntu-20.04 Running 2

i have pulled from github to make sure i am on latest notebooks. then i restarted and run all cells to make sure i didn’t confuse order or cells. however the results are identical for linear regression and ridge and they are different than in the course website.

OK, so it should be linked to what I mentioned earlier. Basically, having correlated features will lead to numerical imprecision due to the matrix inversion when computing the solution of the linear regression. On your system, it seems that the numerical error does not occur.

@ogrisel Do you have any idea on how WSL is working regarding the SciPy low level implementation.

1 Like

Oh i see. Thank you for looking into that.

i have re-run it on windows and result is different to what i got on linux, but also different to what is in online course website:

So it is going sideways as well in a different way :slight_smile: It would be nice that we find a way to make it quite reproducible. At least, we know it is on FUN :slight_smile:

1 Like

So it is going sideways as well in a different way :slight_smile: It would be nice that we find a way to make it quite reproducible. At least, we know it is on FUN

I don’t think we can expect to get a robust reproducibility for numerical instability related behaviors, especially in a cross-platform and cross-scipy-version manner.

1 Like

Not much we can do about this I think, removing the prio-nice-to-hav tag