'''simple docstring'''




from __future__ import annotations

def 	UpperCamelCase_							(					_UpperCAmelCase  :      Dict			,	_UpperCAmelCase  :      Dict			,	_UpperCAmelCase  :      str			,	_UpperCAmelCase  :      Optional[int]    )    ->    Any:  # noqa: E741


       """simple docstring"""







       while r - l > 1:
              _UpperCAmelCase     :  List[Any]							      =    (l + r) // 2
              if v[m] >= key:
                     _UpperCAmelCase     :  Tuple							      =    m
              else:
                     _UpperCAmelCase     :  List[Any]							      =    m  # noqa: E741
       return r

def 	UpperCamelCase_							(					_UpperCAmelCase  :      list[int]    )    ->    int:


       """simple docstring"""







       if len(_UpperCAmelCase    ) == 0:
              return 0

       _UpperCAmelCase     :  Any							      =    [0] * len(_UpperCAmelCase    )
       _UpperCAmelCase     :  str							      =    1

       _UpperCAmelCase     :  List[str]							      =    v[0]

       for i in range(1			,	len(_UpperCAmelCase    )    ):
              if v[i] < tail[0]:
                     _UpperCAmelCase     :  Tuple							      =    v[i]
              elif v[i] > tail[length - 1]:
                     _UpperCAmelCase     :  Tuple							      =    v[i]
                     length += 1
              else:
                     _UpperCAmelCase     :  str							      =    v[i]

       return length


if __name__ == "__main__":
  import doctest

  doctest.testmod()


'''simple docstring'''




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 	UpperCamelCase_							(					_UpperCAmelCase  :      dict    )    ->    tuple:


       """simple docstring"""







       return (data["data"], data["target"])

def 	UpperCamelCase_							(					_UpperCAmelCase  :      np.ndarray			,	_UpperCAmelCase  :      np.ndarray    )    ->    XGBClassifier:


       """simple docstring"""







       _UpperCAmelCase     :  Any							      =    XGBClassifier()
       classifier.fit(_UpperCAmelCase			,	_UpperCAmelCase    )
       return classifier

def 	UpperCamelCase_							(					)    ->    None:


       """simple docstring"""







       _UpperCAmelCase     :  List[str]							      =    load_iris()
       _UpperCAmelCase      ,  _UpperCAmelCase     :  Dict							      =    data_handling(_UpperCAmelCase    )
       _UpperCAmelCase      ,  _UpperCAmelCase      ,  _UpperCAmelCase      ,  _UpperCAmelCase     :  str							      =    train_test_split(
           _UpperCAmelCase			,	_UpperCAmelCase			,	test_size=0.2_5    )

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

       # Create an XGBoost Classifier from the training data
       _UpperCAmelCase     :  Tuple							      =    xgboost(_UpperCAmelCase			,	_UpperCAmelCase    )

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


if __name__ == "__main__":
  import doctest

  doctest.testmod(verbose=True)
  main()

