


"""simple docstring"""







def      UpperCAmelCase__ (lowerCAmelCase_						,		lowerCAmelCase_     ):




					'''simple docstring'''


					def get_matched_characters(lowerCAmelCase_						,		lowerCAmelCase_     ) -> str:
										__SCREAMING_SNAKE_CASE		     =       []
										__SCREAMING_SNAKE_CASE		     =       min(len(_stra     )						,		len(_stra     )     ) // 2
										for i, l in enumerate(_stra     ):
															__SCREAMING_SNAKE_CASE		     =       int(max(0						,		i - limit     )     )
															__SCREAMING_SNAKE_CASE		     =       int(min(i + limit + 1						,		len(_stra     )     )     )
															if l in _stra[left:right]:
																				matched.append(lowerCAmelCase_     )
																				__SCREAMING_SNAKE_CASE		     =       f"""{_stra[0:_stra.index(lowerCAmelCase_     )]} {_stra[_stra.index(lowerCAmelCase_     ) + 1:]}"""

										return "".join(lowerCAmelCase_     )

					# matching characters
					__SCREAMING_SNAKE_CASE		     =       get_matched_characters(lowerCAmelCase_						,		lowerCAmelCase_     )
					__SCREAMING_SNAKE_CASE		     =       get_matched_characters(lowerCAmelCase_						,		lowerCAmelCase_     )
					__SCREAMING_SNAKE_CASE		     =       len(lowerCAmelCase_     )

					# transposition
					__SCREAMING_SNAKE_CASE		     =       (
					    len([(ca, ca) for ca, ca in zip(lowerCAmelCase_						,		lowerCAmelCase_     ) if ca != ca]     ) // 2
					)

					if not match_count:
										__SCREAMING_SNAKE_CASE		     =       0.0
					else:
										__SCREAMING_SNAKE_CASE		     =       (
										    1
										    / 3
										    * (
										        match_count / len(lowerCAmelCase_     )
										        + match_count / len(lowerCAmelCase_     )
										        + (match_count - transpositions) / match_count
										    )
										)

					# common prefix up to 4 characters
					__SCREAMING_SNAKE_CASE		     =       0
					for ca, ca in zip(stra[:4]						,		stra[:4]     ):
										if ca == ca:
															prefix_len += 1
										else:
															break

					return jaro + 0.1 * prefix_len * (1 - jaro)


if __name__ == "__main__":
		import doctest

		doctest.testmod()
		print(jaro_winkler('''hello''', '''world'''))




"""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__ (lowerCAmelCase_     ):




					'''simple docstring'''


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




def      UpperCAmelCase__ (lowerCAmelCase_						,		lowerCAmelCase_     ):




					'''simple docstring'''


					__SCREAMING_SNAKE_CASE		     =       XGBClassifier()
					classifier.fit(lowerCAmelCase_						,		lowerCAmelCase_     )
					return classifier




def      UpperCAmelCase__ ():




					'''simple docstring'''


					__SCREAMING_SNAKE_CASE		     =       load_iris()
					__SCREAMING_SNAKE_CASE     ,						__SCREAMING_SNAKE_CASE		     =       data_handling(lowerCAmelCase_     )
					__SCREAMING_SNAKE_CASE     ,						__SCREAMING_SNAKE_CASE     ,						__SCREAMING_SNAKE_CASE     ,						__SCREAMING_SNAKE_CASE		     =       train_test_split(
					    lowerCAmelCase_						,		lowerCAmelCase_						,		test_size=0.25     )

					__SCREAMING_SNAKE_CASE		     =       iris["target_names"]

					# Create an XGBoost Classifier from the training data
					__SCREAMING_SNAKE_CASE		     =       xgboost(lowerCAmelCase_						,		lowerCAmelCase_     )

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


if __name__ == "__main__":
		import doctest

		doctest.testmod(verbose=True)
		main()
