This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.linear_model import ElasticNet | |
elastic_net = ElasticNet(alpha=0.1, l1_ratio=0.5, random_state=42) | |
elastic_net.fit(X, y) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.linear_model import Lasso | |
lasso_reg = Lasso(alpha=0.1) | |
lasso_reg.fit(X, y) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.linear_model import Ridge | |
ridge_reg = Ridge(alpha=1, solver="cholesky", random_state=42) | |
ridge_reg.fit(X, y) | |
# 'cholesky' is a matrix factorixation techinque used in the closed form equation |