



"""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 							SCREAMING_SNAKE_CASE__      (		SCREAMING_SNAKE_CASE__ :  dict			):



					"""simple docstring"""





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







def 							SCREAMING_SNAKE_CASE__      (		SCREAMING_SNAKE_CASE__ :  np.ndarray				,    SCREAMING_SNAKE_CASE__ :  np.ndarray			):



					"""simple docstring"""





					snake_case_					:		Any 					=					XGBClassifier()
					classifier.fit(SCREAMING_SNAKE_CASE__				,    SCREAMING_SNAKE_CASE__			)
					return classifier







def 							SCREAMING_SNAKE_CASE__      (		):



					"""simple docstring"""





					snake_case_					:		Any 					=					load_iris()
					snake_case_					,			snake_case_					:		Tuple 					=					data_handling(SCREAMING_SNAKE_CASE__			)
					snake_case_					,			snake_case_					,			snake_case_					,			snake_case_					:		str 					=					train_test_split(
					    SCREAMING_SNAKE_CASE__				,    SCREAMING_SNAKE_CASE__				,    test_size=0.25			)

					snake_case_					:		Union[str, Any] 					=					iris["""target_names"""]

					# Create an XGBoost Classifier from the training data
					snake_case_					:		Optional[int] 					=					xgboost(SCREAMING_SNAKE_CASE__				,    SCREAMING_SNAKE_CASE__			)

					# Display the confusion matrix of the classifier with both training and test sets
					ConfusionMatrixDisplay.from_estimator(
					    SCREAMING_SNAKE_CASE__				,    SCREAMING_SNAKE_CASE__				,    SCREAMING_SNAKE_CASE__				,    display_labels=SCREAMING_SNAKE_CASE__				,    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 copy
from dataclasses import dataclass, field
from typing import ClassVar, Dict

from ..features import Audio, Features, Value
from .base import TaskTemplate







@dataclass(frozen=_UpperCAmelCase)
class    __lowercase     (					_UpperCAmelCase):







						"""simple docstring"""







						_A		:							str							       =		field(default="""automatic-speech-recognition"""					,    metadata={"""include_in_asdict_even_if_is_default""": True})
						_A		:							ClassVar[Features]							       =		Features({"""audio""": Audio()})
						_A		:							ClassVar[Features]							       =		Features({"""transcription""": Value("""string""")})
						_A		:							str							       =		"audio"
						_A		:							str							       =		"transcription"







						def 						__UpperCamelCase							(self   ,		lowercase__       ):
											if self.audio_column not in features:
																raise ValueError(f'Column {self.audio_column} is not present in features.'       )
											if not isinstance(features[self.audio_column]   ,		lowercase__       ):
																raise ValueError(f'Column {self.audio_column} is not an Audio type.'       )
											snake_case_					:		Optional[int] 					=					copy.deepcopy(self       )
											snake_case_					:		Tuple 					=					self.input_schema.copy()
											snake_case_					:		List[str] 					=					features[self.audio_column]
											snake_case_					:		Any 					=					input_schema
											return task_template







						@property
						def 						__UpperCamelCase							(self       ):
											return {self.audio_column: "audio", self.transcription_column: "transcription"}




