






'''simple docstring'''


import math
class    _SCREAMING_SNAKE_CASE							:


			'''simple docstring'''





			def 				A      (   self							:						List[str] ,      lowercase							:						list[list[float]] ,      lowercase							:						list[int]			)							->    int:

									'''simple docstring'''







									UpperCamelCase__         = 0.0
									UpperCamelCase__         = 0.0
									for i in range(len(lowercase			)			):
															da += math.pow((sample[i] - weights[0][i]) ,      2			)
															da += math.pow((sample[i] - weights[1][i]) ,      2			)
															return 0 if da > da else 1
									return 0







			def 				A      (   self							:						Tuple ,      lowercase							:						list[list[int | float]] ,      lowercase							:						list[int] ,      lowercase							:						int ,      lowercase							:						float			)							->    list[list[int | float]]:

									'''simple docstring'''







									for i in range(len(lowercase			)			):
															weights[j][i] += alpha * (sample[i] - weights[j][i])
									return weights







def 	__magic_name__( ):
						'''simple docstring'''





						UpperCamelCase__         = [[1, 1, 0, 0], [0, 0, 0, 1], [1, 0, 0, 0], [0, 0, 1, 1]]

						# weight initialization ( n, C )
						UpperCamelCase__         = [[0.2, 0.6, 0.5, 0.9], [0.8, 0.4, 0.7, 0.3]]

						# training
						UpperCamelCase__         = SelfOrganizingMap()
						UpperCamelCase__         = 3
						UpperCamelCase__         = 0.5

						for _ in range(_A					):
												for j in range(len(_A					)					):
																		# training sample
																		UpperCamelCase__         = training_samples[j]

																		# Compute the winning vector
																		UpperCamelCase__         = self_organizing_map.get_winner(_A						,      _A					)

																		# Update the winning vector
																		UpperCamelCase__         = self_organizing_map.update(_A						,      _A						,      _A						,      _A					)

    # classify test sample
						UpperCamelCase__         = [0, 0, 0, 1]
						UpperCamelCase__         = self_organizing_map.get_winner(_A						,      _A					)

						# results
						print(f"Clusters that the test sample belongs to : {winner}"					)
						print(f"Weights that have been trained : {weights}"					)


# running the main() function
if __name__ == "__main__":
				main()








'''simple docstring'''


import inspect
import unittest
class    _SCREAMING_SNAKE_CASE							(		unittest.TestCase	):


			'''simple docstring'''





			def 				A      (   self							:						Tuple			)							->    Any:

									'''simple docstring'''







									try:
															import diffusers  # noqa: F401
									except ImportError:
															assert False







			def 				A      (   self							:						Optional[int]			)							->    Union[str, Any]:

									'''simple docstring'''







									import diffusers
									from diffusers.dependency_versions_table import deps

									UpperCamelCase__         = inspect.getmembers(lowercase ,      inspect.isclass			)

									for cls_name, cls_module in all_classes:
															if "dummy_" in cls_module.__module__:
																					for backend in cls_module._backends:
																											if backend == "k_diffusion":
																																	UpperCamelCase__         = """k-diffusion"""
																											elif backend == "invisible_watermark":
																																	UpperCamelCase__         = """invisible-watermark"""
																											assert backend in deps, f"{backend} is not in the deps table!"
