


def SCREAMING_SNAKE_CASE	(			__lowerCAmelCase							,   __lowerCAmelCase				)    ->				str:
  if a < 0 or b < 0:
    raise ValueError('''the value of both inputs must be positive'''				)

  snake_case__						= str(bin(__lowerCAmelCase				)				)[2:]  # remove the leading "0b"
  snake_case__						= str(bin(__lowerCAmelCase				)				)[2:]  # remove the leading "0b"

  snake_case__						= max(len(__lowerCAmelCase				)							,   len(__lowerCAmelCase				)				)

  return "0b" + "".join(
      str(int(char_a == '''1''' and char_b == '''1'''				)				)
      for char_a, char_b in zip(a_binary.zfill(__lowerCAmelCase				)							,   b_binary.zfill(__lowerCAmelCase				)				)				)


if __name__ == "__main__":
   import doctest

   doctest.testmod()





import math
class 		__magic_name__						:





     '''simple docstring'''



     def 	SCREAMING_SNAKE_CASE__						(					self:Optional[int]     ,		_a:list[list[float]]     ,		_a:list[int]   ):
       snake_case__						= 0.0
       snake_case__						= 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 	SCREAMING_SNAKE_CASE__						(					self:Tuple     ,		_a:list[list[int | float]]     ,		_a:list[int]     ,		_a:int     ,		_a:float   ):
       for i in range(len(_a   )   ):
         weights[j][i] += alpha * (sample[i] - weights[j][i])
       return weights







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

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

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

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

      # Compute the winning vector
      snake_case__						= self_organizing_map.get_winner(__lowerCAmelCase							,   __lowerCAmelCase				)

      # Update the winning vector
      snake_case__						= self_organizing_map.update(__lowerCAmelCase							,   __lowerCAmelCase							,   __lowerCAmelCase							,   __lowerCAmelCase				)

    # classify test sample
  snake_case__						= [0, 0, 0, 1]
  snake_case__						= self_organizing_map.get_winner(__lowerCAmelCase							,   __lowerCAmelCase				)

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

