


# Lint as: python3
import dataclasses
import re
from dataclasses import dataclass
from functools import total_ordering
from typing import Optional, Union


__lowerCAmelCase	: List[Any]  				=re.compile(r'^(?P<major>\d+)' r'\.(?P<minor>\d+)' r'\.(?P<patch>\d+)$')
@total_ordering
@dataclass
class        _lowercase      :






				'''simple docstring'''



				SCREAMING_SNAKE_CASE__				:			str
				SCREAMING_SNAKE_CASE__				:			Optional[str]						=		None
				SCREAMING_SNAKE_CASE__				:			Optional[Union[str, int]]						=		None
				SCREAMING_SNAKE_CASE__				:			Optional[Union[str, int]]						=		None
				SCREAMING_SNAKE_CASE__				:			Optional[Union[str, int]]						=		None


				def 		__magic_name__(       self			:Optional[Any]	)		->			Tuple:
										__SCREAMING_SNAKE_CASE			,			__SCREAMING_SNAKE_CASE			,			__SCREAMING_SNAKE_CASE						:     Optional[Any]					=		_str_to_version_tuple(self.version_str	)


				def __repr__(       self			:Optional[Any]	)		->			Optional[Any]:
										return f'''{self.tuple[0]}.{self.tuple[1]}.{self.tuple[2]}'''


				@property
				def 		__magic_name__(       self			:str	)		->			str:
										return self.major, self.minor, self.patch


				def 		__magic_name__(       self			:List[Any]			,			lowerCAmelCase__			:List[Any]	)		->			List[Any]:
										if isinstance(lowerCAmelCase__			,			lowerCAmelCase__	):
																return Version(lowerCAmelCase__	)
										elif isinstance(lowerCAmelCase__			,			lowerCAmelCase__	):
																return other
										raise TypeError(f'''{other} (type {type(lowerCAmelCase__	)}) cannot be compared to version.'''	)


				def __eq__(       self			:Optional[Any]			,			lowerCAmelCase__			:Optional[int]	)		->			Union[str, Any]:
										try:
																__SCREAMING_SNAKE_CASE						:     int					=		self._validate_operand(lowerCAmelCase__	)
										except (TypeError, ValueError):
																return False
										else:
																return self.tuple == other.tuple


				def __lt__(       self			:Tuple			,			lowerCAmelCase__			:Union[str, Any]	)		->			int:
										__SCREAMING_SNAKE_CASE						:     str					=		self._validate_operand(lowerCAmelCase__	)
										return self.tuple < other.tuple


				def __hash__(       self			:Any	)		->			List[Any]:
										return hash(_version_tuple_to_str(self.tuple	)	)


				@classmethod
				def 		__magic_name__(       cls			:Any			,			lowerCAmelCase__			:Dict	)		->			str:
										__SCREAMING_SNAKE_CASE						:     Union[str, Any]					=		{f.name for f in dataclasses.fields(cls	)}
										return cls(**{k: v for k, v in dic.items() if k in field_names}	)



				def 		__magic_name__(       self			:List[Any]	)		->			str:
										return self.version_str




def        _UpperCamelCase							(      lowercase__      ):
						__SCREAMING_SNAKE_CASE						:     List[Any]					=		_VERSION_REG.match(lowercase__      )
						if not res:
												raise ValueError(F'''Invalid version \'{version_str}\'. Format should be x.y.z with {{x,y,z}} being digits.'''      )
						return tuple(int(lowercase__      ) for v in [res.group('''major'''      ), res.group('''minor'''      ), res.group('''patch'''      )]      )


def        _UpperCamelCase							(      lowercase__      ):
						return ".".join(str(lowercase__      ) for v in version_tuple      )




from collections import Counter

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

__lowerCAmelCase	: List[Any]  				=datasets.load_iris()

__lowerCAmelCase	: Tuple  				=np.array(data['data'])
__lowerCAmelCase	: Dict  				=np.array(data['target'])
__lowerCAmelCase	: List[str]  				=data['target_names']

__lowerCAmelCase				,__lowerCAmelCase				,__lowerCAmelCase				,__lowerCAmelCase	: str  				=train_test_split(X, y)


def        _UpperCamelCase							(      lowercase__    ,       lowercase__      ):
						return np.linalg.norm(np.array(lowercase__      ) - np.array(lowercase__      )      )


def        _UpperCamelCase							(      lowercase__    ,       lowercase__    ,       lowercase__    ,       lowercase__    ,       lowercase__=5      ):
						__SCREAMING_SNAKE_CASE						:     Optional[int]					=		zip(lowercase__    ,       lowercase__      )
						# List of distances of all points from the point to be classified
						__SCREAMING_SNAKE_CASE						:     Dict					=		[]
						for data_point in data:
												__SCREAMING_SNAKE_CASE						:     Tuple					=		euclidean_distance(data_point[0]    ,       lowercase__      )
												distances.append((distance, data_point[1])      )
						# Choosing 'k' points with the least distances.
						__SCREAMING_SNAKE_CASE						:     int					=		[i[1] for i in sorted(lowercase__      )[:k]]
						# Most commonly occurring class among them
						# is the class into which the point is classified
						__SCREAMING_SNAKE_CASE						:     Any					=		Counter(lowercase__      ).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]))
