7
7
8
8
def dataset (datatype : dict ) -> tuple :
9
9
# 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 ))
11
13
return x
12
14
13
15
@@ -17,6 +19,7 @@ def xgboost(features: list, target: list, test_features: list) -> list:
17
19
# Predict target for test data
18
20
predictions = xgb .predict (test_features )
19
21
predictions = predictions .reshape (len (predictions ), 1 )
22
+ print (type (predictions ))
20
23
return predictions
21
24
22
25
@@ -29,12 +32,8 @@ def main() -> None:
29
32
"""
30
33
# Load Boston house price dataset
31
34
boston = load_boston ()
32
- print (boston .keys ())
33
35
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 )
38
37
predictions = xgboost (x_train , y_train , x_test )
39
38
40
39
# Error printing
0 commit comments