





from collections import Counter

import numpy as np
from sklearn import datasets
from sklearn.model_selection import train_test_split

UpperCamelCase__      =datasets.load_iris()

UpperCamelCase__      =np.array(data['data'])
UpperCamelCase__      =np.array(data['target'])
UpperCamelCase__      =data['target_names']

UpperCamelCase__ ,     UpperCamelCase__ ,     UpperCamelCase__ ,     UpperCamelCase__      =train_test_split(X, y)






def     lowerCamelCase__			(__lowerCamelCase,       __lowerCamelCase	):
     return np.linalg.norm(np.array(__lowerCamelCase	) - np.array(__lowerCamelCase	)	)






def     lowerCamelCase__			(__lowerCamelCase,       __lowerCamelCase,       __lowerCamelCase,       __lowerCamelCase,       __lowerCamelCase=5	):
     _SCREAMING_SNAKE_CASE       :	List[str]						    =							zip(__lowerCamelCase,       __lowerCamelCase	)
     # List of distances of all points from the point to be classified
     _SCREAMING_SNAKE_CASE       :	List[str]						    =							[]
     for data_point in data:
          _SCREAMING_SNAKE_CASE       :	List[Any]						    =							euclidean_distance(data_point[0],       __lowerCamelCase	)
          distances.append((distance, data_point[1])	)
     # Choosing 'k' points with the least distances.
     _SCREAMING_SNAKE_CASE       :	str						    =							[i[1] for i in sorted(__lowerCamelCase	)[:k]]
     # Most commonly occurring class among them
     # is the class into which the point is classified
     _SCREAMING_SNAKE_CASE       :	Tuple						    =							Counter(__lowerCamelCase	).most_common(1	)[0][0]
     return classes[result]


if __name__ == "__main__":
       print(classifier(X_train, y_train, classes, [4.4, 3.1, 1.3, 1.4]))






def     lowerCamelCase__			(__lowerCamelCase,       __lowerCamelCase	):
     while a != 0:
          _SCREAMING_SNAKE_CASE    ,			_SCREAMING_SNAKE_CASE       :	Any						    =							b % a, a
     return b






def     lowerCamelCase__			(__lowerCamelCase,       __lowerCamelCase	):
     if gcd(__lowerCamelCase,       __lowerCamelCase	) != 1:
          _SCREAMING_SNAKE_CASE       :	int						    =							f"""mod inverse of {a!r} and {m!r} does not exist"""
          raise ValueError(__lowerCamelCase	)
     _SCREAMING_SNAKE_CASE    ,			_SCREAMING_SNAKE_CASE    ,			_SCREAMING_SNAKE_CASE       :	List[str]						    =							1, 0, a
     _SCREAMING_SNAKE_CASE    ,			_SCREAMING_SNAKE_CASE    ,			_SCREAMING_SNAKE_CASE       :	List[str]						    =							0, 1, m
     while va != 0:
          _SCREAMING_SNAKE_CASE       :	Union[str, Any]						    =							ua // va
          _SCREAMING_SNAKE_CASE    ,			_SCREAMING_SNAKE_CASE    ,			_SCREAMING_SNAKE_CASE    ,			_SCREAMING_SNAKE_CASE    ,			_SCREAMING_SNAKE_CASE    ,			_SCREAMING_SNAKE_CASE       :	Union[str, Any]						    =							(ua - q * va), (ua - q * va), (ua - q * va), va, va, va
     return ua % m