

'''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 		_A     (    A__      ):






 """simple docstring"""



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


def 		_A     (    A__     ,				A__      ):






 """simple docstring"""



 __lowercase							  = XGBClassifier()
 classifier.fit(A__     ,				A__      )
 return classifier


def 		_A     (    ):






 """simple docstring"""



 __lowercase							  = load_iris()
 __lowercase  ,	__lowercase							  = data_handling(A__      )
 __lowercase  ,	__lowercase  ,	__lowercase  ,	__lowercase							  = train_test_split(
     A__     ,				A__     ,				test_size=0.2_5      )

 __lowercase							  = iris['''target_names''']

 # Create an XGBoost Classifier from the training data
 __lowercase							  = xgboost(A__     ,				A__      )

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


if __name__ == "__main__":
 import doctest

 doctest.testmod(verbose=True)
 main()




'''simple docstring'''






import colorsys

from PIL import Image  # type: ignore


def 		_A     (    A__     ,				A__     ,				A__      ):






 """simple docstring"""



 __lowercase							  = x
 __lowercase							  = y
 for step in range(A__      ):  # noqa: B007
  __lowercase							  = a * a - b * b + x
  __lowercase							  = 2 * a * b + y
  __lowercase							  = a_new

  # divergence happens for all complex number with an absolute value
  # greater than 4
  if a * a + b * b > 4:
   break
 return step / (max_step - 1)


def 		_A     (    A__      ):






 """simple docstring"""



 if distance == 1:
  return (0, 0, 0)
 else:
  return (255, 255, 255)


def 		_A     (    A__      ):






 """simple docstring"""



 if distance == 1:
  return (0, 0, 0)
 else:
  return tuple(round(i * 255      ) for i in colorsys.hsv_to_rgb(A__     ,				1     ,				1      )      )


def 		_A     (    A__ = 800     ,				A__ = 600     ,				A__ = -0.6     ,				A__ = 0     ,				A__ = 3.2     ,				A__ = 50     ,				A__ = True     ,				):






 """simple docstring"""



 __lowercase							  = Image.new('''RGB'''     ,				(image_width, image_height)      )
 __lowercase							  = img.load()

 # loop through the image-coordinates
 for image_x in range(A__      ):
  for image_y in range(A__      ):
   # determine the figure-coordinates based on the image-coordinates
   __lowercase							  = figure_width / image_width * image_height
   __lowercase							  = figure_center_x + (image_x / image_width - 0.5) * figure_width
   __lowercase							  = figure_center_y + (image_y / image_height - 0.5) * figure_height

   __lowercase							  = get_distance(A__     ,				A__     ,				A__      )

   # color the corresponding pixel based on the selected coloring-function
   if use_distance_color_coding:
    __lowercase							  = get_color_coded_rgb(A__      )
   else:
    __lowercase							  = get_black_and_white_rgb(A__      )

 return img


if __name__ == "__main__":
 import doctest

 doctest.testmod()

 # colored version, full figure
 lowerCAmelCase__											=	get_image()

 # uncomment for colored version, different section, zoomed in
 # img = get_image(figure_center_x = -0.6, figure_center_y = -0.4,
 # figure_width = 0.8)

 # uncomment for black and white version, full figure
 # img = get_image(use_distance_color_coding = False)

 # uncomment to save the image
 # img.save("mandelbrot.png")

 img.show()

