Skip to content

Commit 93f1c64

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 776162d commit 93f1c64

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

machine_learning/xgboostclassifier.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@
66
from xgboost import XGBClassifier
77

88

9-
def data_handling(data: list) -> tuple[list,list,list]:
9+
def data_handling(data: list) -> tuple[list, list, list]:
1010
# Split dataset into train and test data
11-
x=(data["data"],data["target"],data['target_names']) #data is features
11+
x = (data["data"], data["target"], data["target_names"]) # data is features
1212
return x
1313

1414

15-
def xgboost(features: list, target: list,test_features: list,test_targets: list,namesofflowers: list) -> None:
15+
def xgboost(
16+
features: list,
17+
target: list,
18+
test_features: list,
19+
test_targets: list,
20+
namesofflowers: list,
21+
) -> None:
1622
classifier = XGBClassifier()
1723
classifier.fit(features, target)
1824
# Display Confusion Matrix of Classifier
@@ -28,6 +34,7 @@ def xgboost(features: list, target: list,test_features: list,test_targets: list,
2834
plt.title("Normalized Confusion Matrix - IRIS Dataset")
2935
plt.show()
3036

37+
3138
def main() -> None:
3239

3340
"""
@@ -38,14 +45,16 @@ def main() -> None:
3845

3946
# Load Iris dataset
4047
iris = load_iris()
41-
48+
4249
features, target, names = data_handling(iris)
43-
50+
4451
x_train, x_test, y_train, y_test = train_test_split(
45-
features, target, test_size=0.25)
52+
features, target, test_size=0.25
53+
)
4654

4755
# XGBoost Classifier
48-
xgboost(x_train, y_train,x_test,y_test,names)
56+
xgboost(x_train, y_train, x_test, y_test, names)
57+
4958

5059
if __name__ == "__main__":
5160
main()

0 commit comments

Comments
 (0)