Skip to content

Commit 36f5d87

Browse files
authored
1 parent 349733d commit 36f5d87

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

machine_learning/xgboostregressor.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77

88
def dataset(datatype: dict) -> tuple:
99
# Split dataset into train and test data
10-
x = (datatype["data"], datatype["target"]) # features
10+
features=datatype["data"]
11+
target=datatype["target"]
12+
x = (train_test_split(features, target, test_size=0.25))
1113
return x
1214

1315

@@ -17,6 +19,7 @@ def xgboost(features: list, target: list, test_features: list) -> list:
1719
# Predict target for test data
1820
predictions = xgb.predict(test_features)
1921
predictions = predictions.reshape(len(predictions), 1)
22+
print(type(predictions))
2023
return predictions
2124

2225

@@ -29,12 +32,8 @@ def main() -> None:
2932
"""
3033
# Load Boston house price dataset
3134
boston = load_boston()
32-
print(boston.keys())
3335

34-
features, target = dataset(boston)
35-
x_train, x_test, y_train, y_test = train_test_split(
36-
features, target, test_size=0.25, random_state=1
37-
)
36+
x_train, x_test, y_train, y_test = dataset(boston)
3837
predictions = xgboost(x_train, y_train, x_test)
3938

4039
# Error printing

0 commit comments

Comments
 (0)