python 特征缩放

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 特征缩放相关的知识,希望对你有一定的参考价值。

from sklearn.linear_model import Lasso
from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
X_scaled = scaler.fit_transform(X)

lasso_reg = Lasso()
lasso_reg.fit(X_scaled, y)

# To retrieve and print out the coefficients from the regression model.
reg_coef = lasso_reg.coef_
print(reg_coef)

以上是关于python 特征缩放的主要内容,如果未能解决你的问题,请参考以下文章