Skip to content

Commit

Permalink
implemented Ridge regression
Browse files Browse the repository at this point in the history
  • Loading branch information
LordSomen committed Jul 9, 2018
1 parent 1122f59 commit 4b23a7d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions diff_ml_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,21 @@ def plot_learning_curves(model,X,Y):
))
plot_learning_curves(polynomial_regression, X_p, Y_p)

#%%
'''
this is the implementation of ridge regression
'''
from sklearn.linear_model import Ridge
ridge_model = Ridge(alpha= 1 , solver="cholesky")
ridge_model.fit(X_p,Y_p)
ridge_model.predict([[1.5]])

#%%
from sklearn.linear_model import SGDRegressor
sgd_reg = SGDRegressor(penalty="l2")
sgd_reg.fit(X, Y.ravel())
sgd_reg.predict([[1.5]])




0 comments on commit 4b23a7d

Please sign in to comment.