






"""simple docstring"""





import math



class       __A		:

					def   lowerCamelCase__   (			self  :      List[Any]     ,		__snake_case  :      List[str]     ,		__snake_case  :      Any					)			->							int:
											__magic_name__:	Union[str, Any]							=       0.0
											__magic_name__:	Optional[Any]							=       0.0
											for i in range(len(A__					)					):
																	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   lowerCamelCase__   (			self  :      List[Any]     ,		__snake_case  :      Any     ,		__snake_case  :      Optional[int]     ,		__snake_case  :      Any     ,		__snake_case  :      int					)			->							Optional[Any]:
											for i in range(len(A__					)					):
																	weights[j][i] += alpha * (sample[i] - weights[j][i])
											return weights



def   a    (     )    ->							None:
						# Training Examples ( m, n )
						__magic_name__:	List[str]							=       [[1, 1, 0, 0], [0, 0, 0, 1], [1, 0, 0, 0], [0, 0, 1, 1]]

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

						# training
						__magic_name__:	Any							=       SelfOrganizingMap()
						__magic_name__:	List[Any]							=       3
						__magic_name__:	Dict							=       0.5

						for _ in range(lowercase_  ):
												for j in range(len(lowercase_  )  ):
																		# training sample
																		__magic_name__:	str							=       training_samples[j]

																		# Compute the winning vector
																		__magic_name__:	Union[str, Any]							=       self_organizing_map.get_winner(lowercase_      ,   lowercase_  )

																		# Update the winning vector
																		__magic_name__:	Optional[Any]							=       self_organizing_map.update(lowercase_      ,   lowercase_      ,   lowercase_      ,   lowercase_  )

    # classify test sample
						__magic_name__:	Any							=       [0, 0, 0, 1]
						__magic_name__:	List[Any]							=       self_organizing_map.get_winner(lowercase_      ,   lowercase_  )

						# 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()






A_			:					Union[str, Any]    			=     '\n# Installazione di Transformers\n! pip install transformers datasets\n# Per installare dalla fonte invece dell\'ultima versione rilasciata, commenta il comando sopra e\n# rimuovi la modalità commento al comando seguente.\n# ! pip install git+https://github.com/huggingface/transformers.git\n'

A_			:					str    			=     [{'type': 'code', 'content': INSTALL_CONTENT}]
A_			:					Any    			=     {
    '{processor_class}': 'FakeProcessorClass',
    '{model_class}': 'FakeModelClass',
    '{object_class}': 'FakeObjectClass',
}



