






import numpy as np
from matplotlib import pyplot as plt
from sklearn.datasets import load_iris
from sklearn.metrics import ConfusionMatrixDisplay
from sklearn.model_selection import train_test_split
from xgboost import XGBClassifier






def 				lowerCamelCase__      (    __lowerCamelCase			:     dict		):
  return (data["data"], data["target"])






def 				lowerCamelCase__      (    __lowerCamelCase			:     np.ndarray  ,		__lowerCamelCase			:     np.ndarray		):
  __UpperCAmelCase							:	Dict           =  XGBClassifier()
  classifier.fit(__lowerCamelCase  ,		__lowerCamelCase		)
  return classifier






def 				lowerCamelCase__      (    ):
  __UpperCAmelCase							:	List[str]           =  load_iris()
  __UpperCAmelCase      , __UpperCAmelCase							:	str           =  data_handling(__lowerCamelCase		)
  __UpperCAmelCase      , __UpperCAmelCase      , __UpperCAmelCase      , __UpperCAmelCase							:	List[str]           =  train_test_split(
      __lowerCamelCase  ,		__lowerCamelCase  ,		test_size=0.2_5		)

  __UpperCAmelCase							:	Optional[Any]           =  iris["""target_names"""]

  # Create an XGBoost Classifier from the training data
  __UpperCAmelCase							:	List[Any]           =  xgboost(__lowerCamelCase  ,		__lowerCamelCase		)

  # Display the confusion matrix of the classifier with both training and test sets
  ConfusionMatrixDisplay.from_estimator(
      __lowerCamelCase  ,		__lowerCamelCase  ,		__lowerCamelCase  ,		display_labels=__lowerCamelCase  ,		cmap="""Blues"""  ,		normalize="""true"""  ,		)
  plt.title("""Normalized Confusion Matrix - IRIS Dataset"""		)
  plt.show()


if __name__ == "__main__":
       import doctest

       doctest.testmod(verbose=True)
       main()










from __future__ import annotations

import typing
from collections.abc import Iterable

import numpy as np

a		:       Dict			     = typing.Union[Iterable[float], Iterable[int], np.ndarray]  # noqa: UP007
a		:       Any			     = typing.Union[np.floataa, int, float]  # noqa: UP007






def 				lowerCamelCase__      (    __lowerCamelCase			:     Vector  ,		__lowerCamelCase			:     Vector		):
  return np.sqrt(np.sum((np.asarray(__lowerCamelCase		) - np.asarray(__lowerCamelCase		)) ** 2		)		)






def 				lowerCamelCase__      (    __lowerCamelCase			:     Vector  ,		__lowerCamelCase			:     Vector		):
  return sum((va - va) ** 2 for va, va in zip(__lowerCamelCase  ,		__lowerCamelCase		)		) ** (1 / 2)


if __name__ == "__main__":






       def 				lowerCamelCase__      (    ):
         from timeit import timeit

         print("""Without Numpy"""		)
         print(
             timeit(
                 """euclidean_distance_no_np([1, 2, 3], [4, 5, 6])"""  ,		number=10000  ,		globals=globals()  ,		)		)
         print("""With Numpy"""		)
         print(
             timeit(
                 """euclidean_distance([1, 2, 3], [4, 5, 6])"""  ,		number=10000  ,		globals=globals()  ,		)		)







       benchmark()


