
from typing import Any

import numpy as np


def 						UpperCAmelCase      (     a_						)		->     bool:







				"""simple docstring"""



				return np.array_equal(_lowerCamelCase		,       matrix.conjugate().T						)


def 						UpperCAmelCase      (     a_		,       a_						)		->     Any:







				"""simple docstring"""



				__A             =			v.conjugate().T
				__A             =			v_star.dot(_lowerCamelCase						)
				assert isinstance(_lowerCamelCase		,       np.ndarray						)
				return (v_star_dot.dot(_lowerCamelCase						)) / (v_star.dot(_lowerCamelCase						))


def 						UpperCAmelCase      (     )		->     None:







				"""simple docstring"""



				__A             =			np.array([[2, 2 + 1J, 4], [2 - 1J, 3, 1J], [4, -1J, 1]]						)
				__A             =			np.array([[1], [2], [3]]						)
				assert is_hermitian(_lowerCamelCase						), F'''{a} is not hermitian.'''
				print(rayleigh_quotient(_lowerCamelCase		,       _lowerCamelCase						)						)

				__A             =			np.array([[1, 2, 4], [2, 3, -1], [4, -1, 1]]						)
				assert is_hermitian(_lowerCamelCase						), F'''{a} is not hermitian.'''
				assert rayleigh_quotient(_lowerCamelCase		,       _lowerCamelCase						) == float(3						)


if __name__ == "__main__":
				import doctest

				doctest.testmod()
				tests()


from collections import Counter

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

SCREAMING_SNAKE_CASE							:Tuple										=    datasets.load_iris()

SCREAMING_SNAKE_CASE							:Dict										=    np.array(data['data'])
SCREAMING_SNAKE_CASE							:Optional[int]										=    np.array(data['target'])
SCREAMING_SNAKE_CASE							:List[str]										=    data['target_names']

SCREAMING_SNAKE_CASE			,   SCREAMING_SNAKE_CASE			,   SCREAMING_SNAKE_CASE			,   SCREAMING_SNAKE_CASE							:List[Any]										=    train_test_split(X, y)


def 						UpperCAmelCase      (     a_		,       a_						)		->     Tuple:







				"""simple docstring"""



				return np.linalg.norm(np.array(a_						) - np.array(a_						)						)


def 						UpperCAmelCase      (     a_		,       a_		,       a_		,       a_		,       a_=5						)		->     Dict:







				"""simple docstring"""



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