


from manim import *






class       _UpperCamelCase    (					__snake_case				):

				"""simple docstring"""







				def      _UpperCAmelCase					(						self   )	->				Optional[int]:
					A								=				Rectangle(height=0.5				,   width=0.5   )
					A								=				Rectangle(height=0.46				,   width=0.46   ).set_stroke(width=0   )

					A								=				[mem.copy() for i in range(6   )]
					A								=				[mem.copy() for i in range(6   )]
					A								=				VGroup(*a__   ).arrange(a__				,   buff=0   )
					A								=				VGroup(*a__   ).arrange(a__				,   buff=0   )
					A								=				VGroup(a__				,   a__   ).arrange(a__				,   buff=0   )
					A								=				Text("""CPU"""				,   font_size=24   )
					A								=				Group(a__				,   a__   ).arrange(a__				,   buff=0.5				,   aligned_edge=a__   )
					cpu.move_to([-2.5, -0.5, 0]   )
					self.add(a__   )

					A								=				[mem.copy() for i in range(4   )]
					A								=				VGroup(*a__   ).arrange(a__				,   buff=0   )
					A								=				Text("""GPU"""				,   font_size=24   )
					A								=				Group(a__				,   a__   ).arrange(a__				,   buff=0.5				,   aligned_edge=a__   )
					gpu.move_to([-1, -1, 0]   )
					self.add(a__   )

					A								=				[mem.copy() for i in range(6   )]
					A								=				VGroup(*a__   ).arrange(a__				,   buff=0   )

					A								=				Text("""Model"""				,   font_size=24   )
					A								=				Group(a__				,   a__   ).arrange(a__				,   buff=0.5				,   aligned_edge=a__   )
					model.move_to([3, -1.0, 0]   )
					self.add(a__   )

					A								=				[]
					for i, rect in enumerate(a__   ):
						rect.set_stroke(a__   )
						# target = fill.copy().set_fill(YELLOW, opacity=0.7)
						# target.move_to(rect)
						# self.add(target)

						A								=				Rectangle(height=0.46 / 4				,   width=0.46 / 3   ).set_stroke(width=0.0   ).set_fill(a__				,   opacity=0.7   )

						if i == 0:
							cpu_target.next_to(cpu_left_col_base[0].get_corner(DOWN + LEFT   )				,   buff=0.02				,   direction=a__   )
							cpu_target.set_x(cpu_target.get_x() + 0.1   )
						elif i == 3:
							cpu_target.next_to(cpu_targs[0]				,   direction=a__				,   buff=0.0   )
						else:
							cpu_target.next_to(cpu_targs[i - 1]				,   direction=a__				,   buff=0.0   )
						self.add(a__   )
						cpu_targs.append(a__   )

					A								=				[mem.copy() for i in range(6   )]
					A								=				VGroup(*a__   ).arrange(a__				,   buff=0   )

					A								=				Text("""Loaded Checkpoint"""				,   font_size=24   )
					A								=				Group(a__				,   a__   ).arrange(a__				,   aligned_edge=a__				,   buff=0.4   )
					checkpoint.move_to([3, 0.5, 0]   )

					A								=				Square(side_length=2.2   )
					key.move_to([-5, 2, 0]   )

					A								=				MarkupText(
					    f'<b>Key:</b>\n\n<span fgcolor=\'{YELLOW}\'>●</span> Empty Model'				,   font_size=18				,   )

					key_text.move_to([-5, 2.4, 0]   )

					self.add(a__				,   a__   )

					A								=				MarkupText(
					    f'<span fgcolor=\'{BLUE}\'>●</span> Checkpoint'				,   font_size=18				,   )

					blue_text.next_to(a__				,   DOWN * 2.4				,   aligned_edge=key_text.get_left()   )

					A								=				MarkupText(
					    f'Next, a <i><span fgcolor="{BLUE}">second</span></i> model is loaded into memory,\nwith the weights of a <span fgcolor="{BLUE}">single shard</span>.'				,   font_size=24				,   )
					step_a.move_to([2, 2, 0]   )
					self.play(Write(a__   )				,   Write(a__   )   )

					self.play(Write(a__				,   run_time=1   )				,   Create(a__				,   run_time=1   )   )

					A								=				[]
					A								=				[]
					for i, rect in enumerate(a__   ):
						A								=				fill.copy().set_fill(a__				,   opacity=0.7   )
						target.move_to(a__   )
						first_animations.append(GrowFromCenter(a__				,   run_time=1   )   )

						A								=				target.copy()
						cpu_target.generate_target()
						if i < 5:
							cpu_target.target.move_to(cpu_left_col_base[i + 1]   )
						else:
							cpu_target.target.move_to(cpu_right_col_base[i - 5]   )
						second_animations.append(MoveToTarget(a__				,   run_time=1.5   )   )

					self.play(*a__   )
					self.play(*a__   )
					self.wait()







from collections import Counter

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

_lowercase       :      Any	=	datasets.load_iris()

_lowercase       :      Tuple	=	np.array(data["data"])
_lowercase       :      int	=	np.array(data["target"])
_lowercase       :      int	=	data["target_names"]

_lowercase	,							_lowercase	,							_lowercase	,							_lowercase       :      Any	=	train_test_split(X, y)





def   _lowerCAmelCase				(   UpperCamelCase__:     int							,					UpperCamelCase__:     Any						) ->   List[Any]:





	"""simple docstring"""







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





def   _lowerCAmelCase				(   UpperCamelCase__:     str							,					UpperCamelCase__:     Tuple							,					UpperCamelCase__:     int							,					UpperCamelCase__:     List[Any]							,					UpperCamelCase__:     int=5						) ->   Tuple:





	"""simple docstring"""







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



