If the normalization parameter is set to True
in any of the linear models in sklearn.linear_model
, is normalization applied during the score step?
For example:
from sklearn import linear_model
from sklearn.datasets import load_boston
a = load_boston()
l = linear_model.ElasticNet(normalize=False)
l.fit(a["data"][:400], a["target"][:400])
print l.score(a["data"][400:], a["target"][400:])
# 0.24192774524694727
l = linear_model.ElasticNet(normalize=True)
l.fit(a["data"][:400], a["target"][:400])
print l.score(a["data"][400:], a["target"][400:])
# -2.6177006348389167
In this case we see a degradation in the prediction power when we set normalize=True
, and I can't tell if this is simply an artifact of the score
function not applying the normalization, or if the normalized values caused the model
performance to drop.