Skip to content

Instantly share code, notes, and snippets.

View saaranshM's full-sized avatar
:bowtie:
Focusing

Saaransh Menon saaranshM

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