Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

gradient boosting regressor

# Import GradientBoostingRegressor
from sklearn.ensemble import GradientBoostingRegressor

# Instantiate gb
gb = GradientBoostingRegressor(max_depth=4,
                               n_estimators=200,
                               random_state=2)
# Fit gb to the training set
gb.fit(X_train, y_train)

# Predict test set labels
y_pred = gb.predict(X_test)
# Import mean_squared_error as MSE
from sklearn.metrics import mean_squared_error as MSE

# Compute MSE
mse_test = MSE(y_test, y_pred)

# Compute RMSE
rmse_test = mse_test**(1/2)

# Print RMSE
print('Test set RMSE of gb: {:.3f}'.format(rmse_test))
Comment

PREVIOUS NEXT
Code Example
Python :: pyodbc cursor create list of dictionaries 
Python :: pandas fillna with another column 
Python :: unique value python 
Python :: get ip address python 
Python :: how many columns can a pandas dataframe have 
Python :: python list Clear the list content 
Python :: max heap python 
Python :: python do something while waiting for input 
Python :: generate random int python 
Python :: how to change int to four decimal places in python 
Python :: tryexept in python 
Python :: how to check any script is running in background linux using python 
Python :: pytest teardown method 
Python :: seaborn.distplot() 
Python :: import stock data from yahoo finance 
Python :: import path in django 
Python :: delete row if contains certain text pandas 
Python :: pandas series plot horizontal bar 
Python :: how split string in python by size 
Python :: sentence similarity python 
Python :: edit error page flask 
Python :: Invalid password format or unknown hashing algorithm. 
Python :: precision and recall from confusion matrix python 
Python :: matplotlib histogram python 
Python :: create a django project 
Python :: creating dataframe 
Python :: .split python 
Python :: find a key in a dictionary python 
Python :: how to capitalize first letter in python in list using list comprehension 
Python :: Delete python text after 1 sec 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =