



'''simple docstring'''






import sys
from collections import defaultdict

class 				SCREAMING_SNAKE_CASE:







	"""simple docstring"""






	def __init__(						self			:     Any		)			->		str:
								UpperCAmelCase :       Union[str, Any] 							=		[]







	def      A	(						self			:     str		,			__snake_case			:     Any		)			->		Optional[int]:
								return self.node_position[vertex]







	def      A	(						self			:     Dict		,			__snake_case			:     Optional[int]		,			__snake_case			:     Optional[Any]		)			->		Union[str, Any]:
								UpperCAmelCase :       Optional[Any] 							=		pos







	def      A	(						self			:     Union[str, Any]		,			__snake_case			:     Optional[int]		,			__snake_case			:     Dict		,			__snake_case			:     Dict		,			__snake_case			:     str		)			->		Dict:
								if start > size // 2 - 1:
															return
								else:
															if 2 * start + 2 >= size:
																						UpperCAmelCase :       Union[str, Any] 							=		2 * start + 1
															else:
																						if heap[2 * start + 1] < heap[2 * start + 2]:
																													UpperCAmelCase :       Tuple 							=		2 * start + 1
																						else:
																													UpperCAmelCase :       List[str] 							=		2 * start + 2
															if heap[smallest_child] < heap[start]:
																						UpperCAmelCase							,		UpperCAmelCase :       str 							=		heap[smallest_child], positions[smallest_child]
																						UpperCAmelCase							,		UpperCAmelCase :       str 							=		(
																						    heap[start],
																						    positions[start],
																						)
																						UpperCAmelCase							,		UpperCAmelCase :       Any 							=		temp, tempa

																						UpperCAmelCase :       Union[str, Any] 							=		self.get_position(positions[smallest_child]		)
																						self.set_position(
																						    positions[smallest_child]		,			self.get_position(positions[start]		)		)
																						self.set_position(positions[start]		,			__snake_case		)

																						self.top_to_bottom(__snake_case		,			__snake_case		,			__snake_case		,			__snake_case		)







	def      A	(						self			:     Tuple		,			__snake_case			:     Any		,			__snake_case			:     Optional[Any]		,			__snake_case			:     Tuple		,			__snake_case			:     str		)			->		Dict:
								UpperCAmelCase :       Union[str, Any] 							=		position[index]

								while index != 0:
															UpperCAmelCase :       List[str] 							=		int((index - 2) / 2		) if index % 2 == 0 else int((index - 1) / 2		)

															if val < heap[parent]:
																						UpperCAmelCase :       List[Any] 							=		heap[parent]
																						UpperCAmelCase :       str 							=		position[parent]
																						self.set_position(position[parent]		,			__snake_case		)
															else:
																						UpperCAmelCase :       Optional[Any] 							=		val
																						UpperCAmelCase :       Dict 							=		temp
																						self.set_position(__snake_case		,			__snake_case		)
																						break
															UpperCAmelCase :       Optional[int] 							=		parent
								else:
															UpperCAmelCase :       Any 							=		val
															UpperCAmelCase :       Optional[int] 							=		temp
															self.set_position(__snake_case		,			0		)







	def      A	(						self			:     Optional[Any]		,			__snake_case			:     Union[str, Any]		,			__snake_case			:     List[Any]		)			->		Any:
								UpperCAmelCase :       Tuple 							=		len(__snake_case		) // 2 - 1
								for i in range(__snake_case		,			-1		,			-1		):
															self.top_to_bottom(__snake_case		,			__snake_case		,			len(__snake_case		)		,			__snake_case		)







	def      A	(						self			:     Dict		,			__snake_case			:     Optional[Any]		,			__snake_case			:     int		)			->		int:
								UpperCAmelCase :       List[Any] 							=		positions[0]
								UpperCAmelCase :       Optional[int] 							=		sys.maxsize
								self.top_to_bottom(__snake_case		,			0		,			len(__snake_case		)		,			__snake_case		)
								return temp


def  snake_case_     (					_lowerCAmelCase  :						List[str]  )      ->   str:
							UpperCAmelCase :       Union[str, Any] 							=		Heap()

							UpperCAmelCase :       str 							=		[0] * len(_lowerCAmelCase  )
							UpperCAmelCase :       str 							=		[-1] * len(_lowerCAmelCase  )  # Neighboring Tree Vertex of selected vertex
							# Minimum Distance of explored vertex with neighboring vertex of partial tree
							# formed in graph
							UpperCAmelCase :       Optional[int] 							=		[]  # Heap of Distance of vertices from their neighboring vertex
							UpperCAmelCase :       List[str] 							=		[]

							for vertex in range(len(_lowerCAmelCase  )  ):
														distance_tv.append(sys.maxsize  )
														positions.append(_lowerCAmelCase  )
														heap.node_position.append(_lowerCAmelCase  )

							UpperCAmelCase :       List[str] 							=		[]
							UpperCAmelCase :       Tuple 							=		1
							UpperCAmelCase :       Union[str, Any] 							=		sys.maxsize
							for neighbor, distance in adjacency_list[0]:
														UpperCAmelCase :       List[Any] 							=		0
														UpperCAmelCase :       Tuple 							=		distance
							heap.heapify(_lowerCAmelCase   ,      _lowerCAmelCase  )

							for _ in range(1   ,      len(_lowerCAmelCase  )  ):
														UpperCAmelCase :       str 							=		heap.delete_minimum(_lowerCAmelCase   ,      _lowerCAmelCase  )
														if visited[vertex] == 0:
																					tree_edges.append((nbr_tv[vertex], vertex)  )
																					UpperCAmelCase :       Optional[Any] 							=		1
																					for neighbor, distance in adjacency_list[vertex]:
																												if (
																												    visited[neighbor] == 0
																												    and distance < distance_tv[heap.get_position(_lowerCAmelCase  )]
																												):
																																			UpperCAmelCase :       Tuple 							=		distance
																																			heap.bottom_to_top(
																																			    _lowerCAmelCase   ,      heap.get_position(_lowerCAmelCase  )   ,      _lowerCAmelCase   ,      _lowerCAmelCase  )
																																			UpperCAmelCase :       Optional[Any] 							=		vertex
							return tree_edges


if __name__ == "__main__":  # pragma: no cover
						# < --------- Prims Algorithm --------- >
						UpperCamelCase__:   Any								=			int(input("Enter number of edges: ").strip())
						UpperCamelCase__:   Any								=			defaultdict(list)
						for _ in range(edges_number):
												UpperCamelCase__:   Tuple								=			[int(x) for x in input().strip().split()]
												adjacency_list[edge[0]].append([edge[1], edge[2]])
												adjacency_list[edge[1]].append([edge[0], edge[2]])
						print(prisms_algorithm(adjacency_list))






'''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()

