Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

sample stochastic gradient boosting regressor algorithm

# Import GradientBoostingRegressor
from sklearn.ensemble import GradientBoostingRegressor

# Instantiate sgbr
sgbr = GradientBoostingRegressor(max_depth=4, 
                                 subsample=0.9,
                                 max_features=0.75,
                                 n_estimators=200,
                                 random_state=2)
# Fit sgbr to the training set
sgbr.fit(X_train, y_train)

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

# Compute test set MSE
mse_test = MSE(y_test, y_pred)

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

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

PREVIOUS NEXT
Code Example
Python :: Extract columns of dataframe to make new dataframe 
Python :: what is topic modelling in nlp 
Python :: python kivy black screen 
Python :: hashing algorithms in python 
Python :: bold colors in pytohn 
Python :: append to multidimensional list python 
Python :: How to use a function output as an input of another function in Python 
Python :: Read a string with digits from the input and convert each number to an integer. Create a list in which you should include only odd digits. 
Python :: auto indent python code 
Python :: pyaudio get system audio 
Python :: merging timeseries data 
Python :: 1041 uri solution 
Python :: Mapping using dictionary 
Python :: pyqt qwidget background color 
Python :: Pandas: Ternary conditional operator for setting a value in a DataFrame 
Python :: python detect ranges in list 
Python :: appears in json dump 
Python :: np choose explain 
Python :: give utton a number python 
Python :: finns = False 
Python :: bashrc rc meaning 
Python :: additon of multiple duration timestamps python 
Python :: using -h on python file 
Python :: not en python 
Python :: add up all the numbers in each row and output that number output the grand total of all rows 
Python :: import data from website pandas python medium 
Python :: cdf empírica python 
Python :: difference between calling a function and referencing a function python 
Python :: api csv python 
Python :: jouer à Snake 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =