

'''simple docstring'''




from collections import Counter

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

_a					:			Tuple							=    datasets.load_iris()

_a					:			int							=    np.array(data['data'])
_a					:			Optional[int]							=    np.array(data['target'])
_a					:			Any							=    data['target_names']

_a				,   _a				,   _a				,   _a					:			List[str]							=    train_test_split(X, y)


def    lowerCamelCase__		(    SCREAMING_SNAKE_CASE   : Any							, SCREAMING_SNAKE_CASE   : int    ):
  return np.linalg.norm(np.array(SCREAMING_SNAKE_CASE    ) - np.array(SCREAMING_SNAKE_CASE    )    )


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





'''simple docstring'''




import qiskit


def    lowerCamelCase__		(    SCREAMING_SNAKE_CASE   : int							, SCREAMING_SNAKE_CASE   : int    ):
  UpperCAmelCase    				=						qiskit.Aer.get_backend('aer_simulator'    )

  # Create a Quantum Circuit acting on the q register
  UpperCAmelCase    				=						qiskit.QuantumCircuit(SCREAMING_SNAKE_CASE							, SCREAMING_SNAKE_CASE    )

  # Map the quantum measurement to the classical bits
  circuit.measure([0]							, [0]    )

  # Execute the circuit on the simulator
  UpperCAmelCase    				=						qiskit.execute(SCREAMING_SNAKE_CASE							, SCREAMING_SNAKE_CASE							, shots=1000    )

  # Return the histogram data of the results of the experiment.
  return job.result().get_counts(SCREAMING_SNAKE_CASE    )


if __name__ == "__main__":
  print(F'''Total count for various states are: {single_qubit_measure(1, 1)}''')


