MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / data_handling

Function data_handling

machine_learning/xgboost_classifier.py:10–21  ·  view source on GitHub ↗

>>> data_handling(({'data':'[5.1, 3.5, 1.4, 0.2]','target':([0])})) ('[5.1, 3.5, 1.4, 0.2]', [0]) >>> data_handling( ... {'data': '[4.9, 3.0, 1.4, 0.2], [4.7, 3.2, 1.3, 0.2]', 'target': ([0, 0])} ... ) ('[4.9, 3.0, 1.4, 0.2], [4.7, 3.2, 1.3, 0.2]', [0, 0])

(data: dict)

Source from the content-addressed store, hash-verified

8
9
10def data_handling(data: dict) -> tuple:
11 # Split dataset into features and target
12 # data is features
13 """
14 >>> data_handling(({'data':'[5.1, 3.5, 1.4, 0.2]','target':([0])}))
15 ('[5.1, 3.5, 1.4, 0.2]', [0])
16 >>> data_handling(
17 ... {'data': '[4.9, 3.0, 1.4, 0.2], [4.7, 3.2, 1.3, 0.2]', 'target': ([0, 0])}
18 ... )
19 ('[4.9, 3.0, 1.4, 0.2], [4.7, 3.2, 1.3, 0.2]', [0, 0])
20 """
21 return (data["data"], data["target"])
22
23
24def xgboost(features: np.ndarray, target: np.ndarray) -> XGBClassifier:

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected