After training an ML model using https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Lasso.html#sklearn.linear_model.Lasso, when I print out the coefficients, I can see that some of them give 0.00000000e+00 while others are -0.00000000e+00.
Is there a reason for this difference? At the end of the day, I am assuming they are both coefficient=0. (?)
Linear regression models can compute negative coefficients and -0
is the result of rounding originally negative numbers. A comparison like -0 == 0
will yield True
and they behave the same for most operations. However, in operations where the sign is important it will make a difference. Thus, it would account as information loss to drop the -
sign.
For more information on -0
and its behavior in Python, I refer to the answer(s) of this question.