
from __future__ import annotations



def      __lowerCAmelCase						(							UpperCAmelCase__				:      tuple[int, int]			,				UpperCAmelCase__				:      int       )  ->    Optional[Any]:
							lowerCamelCase_  ,   lowerCamelCase_							  =					position
							lowerCamelCase_							  =					[
							    (y + 1, x + 2),
							    (y - 1, x + 2),
							    (y + 1, x - 2),
							    (y - 1, x - 2),
							    (y + 2, x + 1),
							    (y + 2, x - 1),
							    (y - 2, x + 1),
							    (y - 2, x - 1),
							]
							lowerCamelCase_							  =					[]

							for position in positions:
														lowerCamelCase_  ,   lowerCamelCase_							  =					position
														if 0 <= y_test < n and 0 <= x_test < n:
																					permissible_positions.append(UpperCAmelCase__       )

							return permissible_positions



def      __lowerCAmelCase						(							UpperCAmelCase__				:      list[list[int]]       )  ->    Optional[int]:
							return not any(elem == 0 for row in board for elem in row       )



def      __lowerCAmelCase						(							UpperCAmelCase__				:      list[list[int]]			,				UpperCAmelCase__				:      tuple[int, int]			,				UpperCAmelCase__				:      int       )  ->    Dict:






							if is_complete(UpperCAmelCase__       ):
														return True

							for position in get_valid_pos(UpperCAmelCase__			,				len(UpperCAmelCase__       )       ):
														lowerCamelCase_  ,   lowerCamelCase_							  =					position

														if board[y][x] == 0:
																					lowerCamelCase_							  =					curr + 1
																					if open_knight_tour_helper(UpperCAmelCase__			,				UpperCAmelCase__			,				curr + 1       ):
																												return True
																					lowerCamelCase_							  =					0

							return False



def      __lowerCAmelCase						(							UpperCAmelCase__				:      int       )  ->    Optional[int]:
							lowerCamelCase_							  =					[[0 for i in range(UpperCAmelCase__       )] for j in range(UpperCAmelCase__       )]

							for i in range(UpperCAmelCase__       ):
														for j in range(UpperCAmelCase__       ):
																					lowerCamelCase_							  =					1
																					if open_knight_tour_helper(UpperCAmelCase__			,				(i, j)			,				1       ):
																												return board
																					lowerCamelCase_							  =					0

							lowerCamelCase_							  =					F'''Open Kight Tour cannot be performed on a board of size {n}'''
							raise ValueError(UpperCAmelCase__       )


if __name__ == "__main__":
		import doctest

		doctest.testmod()






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						(							UpperCAmelCase__				:      dict       )  ->    tuple:
							return (data["data"], data["target"])



def      __lowerCAmelCase						(							UpperCAmelCase__				:      np.ndarray			,				UpperCAmelCase__				:      np.ndarray       )  ->    XGBClassifier:
							lowerCamelCase_							  =					XGBClassifier()
							classifier.fit(UpperCAmelCase__			,				UpperCAmelCase__       )
							return classifier



def      __lowerCAmelCase						(							)  ->    None:
							lowerCamelCase_							  =					load_iris()
							lowerCamelCase_  ,   lowerCamelCase_							  =					data_handling(UpperCAmelCase__       )
							lowerCamelCase_  ,   lowerCamelCase_  ,   lowerCamelCase_  ,   lowerCamelCase_							  =					train_test_split(
							    UpperCAmelCase__			,				UpperCAmelCase__			,				test_size=0.2_5       )

							lowerCamelCase_							  =					iris["""target_names"""]

							# Create an XGBoost Classifier from the training data
							lowerCamelCase_							  =					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()





