Skip to content

Instantly share code, notes, and snippets.

Avatar
:bowtie:
Focusing

Saaransh Menon saaranshM

:bowtie:
Focusing
View GitHub Profile
@saaranshM
saaranshM / elastic_net.py
Created Dec 16, 2020
Training model using elastic net.
View elastic_net.py
from sklearn.linear_model import ElasticNet
elastic_net = ElasticNet(alpha=0.1, l1_ratio=0.5, random_state=42)
elastic_net.fit(X, y)
@saaranshM
saaranshM / lasso_regression.py
Created Dec 16, 2020
Training model using Lasso Regression
View lasso_regression.py
from sklearn.linear_model import Lasso
lasso_reg = Lasso(alpha=0.1)
lasso_reg.fit(X, y)
@saaranshM
saaranshM / ridge_regression.py
Last active Dec 16, 2020
Training a model using Ridge Regression
View ridge_regression.py
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