Skip to content

Commit 74c8cd3

Browse files
committed
Gradient boosting regressor
1 parent c5e2e09 commit 74c8cd3

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

machine_learning/Gradient-boosting-regressor.py

+4-11
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,10 @@ def main():
2929
y = df_boston.iloc[:, -1] # target variable
3030
# we are going to split the data with 75% train and 25% test sets.
3131
X_train, X_test, y_train, y_test = train_test_split(
32-
X, y, random_state=0, test_size=0.25
33-
)
34-
# model parameter
35-
params = {
36-
"n_estimators": 500,
37-
"max_depth": 5,
38-
"min_samples_split": 4,
39-
"learning_rate": 0.01,
40-
"loss": "ls",
41-
}
42-
model = GradientBoostingRegressor(**params)
32+
X, y, random_state=0, test_size=0.25)
33+
34+
model = GradientBoostingRegressor(n_estimators = 500,
35+
max_depth =5,min_samples_split=4,learning_rate=0.01 )
4336
# training the model
4437
model.fit(X_train, y_train)
4538
"""let have a look on the train and test score to see how good the model fit the data"""

0 commit comments

Comments
 (0)