


"""simple docstring"""






import math


class     __lowerCamelCase  :

     '''simple docstring'''


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







def       A_   (   ):






     """simple docstring"""

     _a    	=				[[1, 1, 0, 0], [0, 0, 0, 1], [1, 0, 0, 0], [0, 0, 1, 1]]

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

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

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

               # Compute the winning vector
               _a    	=				self_organizing_map.get_winner(_lowerCAmelCase,     _lowerCAmelCase       )

               # Update the winning vector
               _a    	=				self_organizing_map.update(_lowerCAmelCase,     _lowerCAmelCase,     _lowerCAmelCase,     _lowerCAmelCase       )

    # classify test sample
     _a    	=				[0, 0, 0, 1]
     _a    	=				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()



"""simple docstring"""






from typing import Any
def       A_   (   _lowerCAmelCase     :					list       ):






     """simple docstring"""

     if not input_list:
          return []
     _a    	=				[input_list.count(_lowerCAmelCase       ) for value in input_list]
     _a    	=				max(_lowerCAmelCase       )  # Gets the maximum count in the input list.
     # Gets values of modes
     return sorted({input_list[i] for i, value in enumerate(_lowerCAmelCase       ) if value == y}       )


if __name__ == "__main__":
   import doctest

   doctest.testmod()