

'''simple docstring'''





import math


class  UpperCAmelCase :

		'''simple docstring'''






		def 			UpperCamelCase(					self   ,			SCREAMING_SNAKE_CASE_   ,			SCREAMING_SNAKE_CASE_		)  ->     int:






							'''simple docstring'''



							lowerCamelCase_  				=      0.0
							lowerCamelCase_  				=      0.0
							for i in range(len(SCREAMING_SNAKE_CASE_		)		):
												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 			UpperCamelCase(					self   ,			SCREAMING_SNAKE_CASE_   ,			SCREAMING_SNAKE_CASE_   ,			SCREAMING_SNAKE_CASE_   ,			SCREAMING_SNAKE_CASE_		)  ->     list[list[int | float]]:






							'''simple docstring'''



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







def   _UpperCamelCase	(		)       ->			None:
					# Training Examples ( m, n )
					lowerCamelCase_  				=      [[1, 1, 0, 0], [0, 0, 0, 1], [1, 0, 0, 0], [0, 0, 1, 1]]

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

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

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

															# Compute the winning vector
															lowerCamelCase_  				=      self_organizing_map.get_winner(__UpperCamelCase    ,__UpperCamelCase	)

															# Update the winning vector
															lowerCamelCase_  				=      self_organizing_map.update(__UpperCamelCase    ,__UpperCamelCase    ,__UpperCamelCase    ,__UpperCamelCase	)

    # classify test sample
					lowerCamelCase_  				=      [0, 0, 0, 1]
					lowerCamelCase_  				=      self_organizing_map.get_winner(__UpperCamelCase    ,__UpperCamelCase	)

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








def 		a__      (		_UpperCamelCase      :			int				):
   __lowerCamelCase    				=     int(_UpperCamelCase				)
   if decimal in (0, 1):  # Exit cases for the recursion
      return str(_UpperCamelCase				)
   __lowerCamelCase				,__lowerCamelCase    				=     divmod(_UpperCamelCase			,2				)
   return binary_recursive(_UpperCamelCase				) + str(_UpperCamelCase				)





def 		a__      (		_UpperCamelCase      :			str				):
   __lowerCamelCase    				=     str(_UpperCamelCase				).strip()
   if not number:
      raise ValueError('''No input value was provided'''				)
   __lowerCamelCase    				=     '''-''' if number.startswith('''-'''				) else ''''''
   __lowerCamelCase    				=     number.lstrip('''-'''				)
   if not number.isnumeric():
      raise ValueError('''Input value is not an integer'''				)
   return F"""{negative}0b{binary_recursive(int(_UpperCamelCase				)				)}"""


if __name__ == "__main__":
  from doctest import testmod

  testmod()






