Sklearn 라쏘 회귀분석

1 개요[ | ]

sklearn 라쏘 회귀분석

2 예시: Boston[ | ]

from sklearn.datasets import load_boston
boston = load_boston()
X = boston.data
y = boston.target

from sklearn.linear_model import Lasso
model = Lasso(alpha=2)
model.fit(X, y)

import pandas as pd
print( pd.DataFrame( model.coef_, index=boston.feature_names, columns=['coef']) )
print( "---" )
print( "SS(coef)=", sum(model.coef_**2) )
print( "R²=", model.score(X, y) )

3 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}