Created
May 12, 2018 21:41
-
-
Save grohith327/4c3db445b9c26acfa2406f25c6c0689f to your computer and use it in GitHub Desktop.
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
# Linear Regression model | |
from sklearn.linear_model import LinearRegression | |
clf_lr = LinearRegression() | |
clf_lr.fit(x_train,y_train) | |
y_pred_lr = clf_lr.predict(x_test) | |
# Support Vector Machine with a Radial Basis Function as kernel | |
from sklearn.svm import SVR | |
clf_svr = SVR(kernel='rbf', C=1e3, gamma=0.1) | |
clf_svr.fit(x_train,y_train) | |
y_pred_svr = clf_svr.predict(x_test) | |
# Random Forest Regressor | |
from sklearn.ensemble import RandomForestRegressor | |
clf_rf = RandomForestRegressor(n_estimators=100) | |
clf_rf.fit(x_train,y_train) | |
y_pred_rf = clf_rf.predict(x_test) | |
# Gradient Boosting Regressor | |
from sklearn.ensemble import GradientBoostingRegressor | |
clf_gb = GradientBoostingRegressor(n_estimators=200) | |
clf_gb.fit(x_train,y_train) | |
y_pred_gb = clf_gb.predict(x_test) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment