Different results in sandbox and loccaly

When I run the correction in the sandbox I observed results in line with text description. But when I run it locally here are the coefficients of linear regression obtain with the correlated data : array([ 3.6313933 , 13.46802113, -0.20549345, -0.18929961, 0.11117205,
3.6313933 , 13.46802113, 3.6313933 , 13.46802113])

It means that when features are repeated coefficient is divided accordingly.

What can be the reason for this difference when running locally or in the sandbox ?

Thanks for help.

May be this due to default parameters of LinearDescription as described in tips but nevertheless behavior should identical in both environment . No ?

As mentioned in this forum comment:

It indeed means that we try to solve an mathematical ill-posed problem. Indeed, finding coefficients in a linear regression involves inverting the matrix np.dot(data.T, data) which is not possible (or lead to high numerical errors).

In this case, matrix is singular (determinant is exactly 0), so it can’t be inverted. The numerical errors may vary according to your local processor.

Thanks for your answer.
But it doesn’t correspond to the result I get. What surprises me is that with the default LinearRegression regressor I get the values of parameters that are obtained with regularization in the solution notebook

So it cannot be interpreted as an error depending on the machine

Then I apologize for not reading carefully your comment. It seems to be the same issue reported in this forum thread. We will have to investigate it, but for the moment I am tagging said thread as priority to review for the next session.

Indeed, teaching this course in different groups of people, I saw that this numerical error does not happen in Windows most probably due to a different implementation of the low-level library. In the future, we will probably find a better example that is not platform dependent.

1 Like