





"""simple docstring"""
import math






class  _SCREAMING_SNAKE_CASE:




       def    _UpperCamelCase					(						self		,SCREAMING_SNAKE_CASE__		,SCREAMING_SNAKE_CASE__							)      ->				int:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE       :Dict		    =  0.0
             __SCREAMING_SNAKE_CASE       :List[str]		    =  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 					__lowerCamelCase       (							)      ->				None:
      # Training Examples ( m, n )
      __SCREAMING_SNAKE_CASE       :List[Any]		    =  [[1, 1, 0, 0], [0, 0, 0, 1], [1, 0, 0, 0], [0, 0, 1, 1]]

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

      # training
      __SCREAMING_SNAKE_CASE       :Union[str, Any]		    =  SelfOrganizingMap()
      __SCREAMING_SNAKE_CASE       :Optional[int]		    =  3
      __SCREAMING_SNAKE_CASE       :List[Any]		    =  0.5

      for _ in range(a_							):
            for j in range(len(a_							)							):
                  # training sample
                  __SCREAMING_SNAKE_CASE       :Union[str, Any]		    =  training_samples[j]

                  # Compute the winning vector
                  __SCREAMING_SNAKE_CASE       :Dict		    =  self_organizing_map.get_winner(a_			,       a_							)

                  # Update the winning vector
                  __SCREAMING_SNAKE_CASE       :Tuple		    =  self_organizing_map.update(a_			,       a_			,       a_			,       a_							)

    # classify test sample
      __SCREAMING_SNAKE_CASE       :Optional[Any]		    =  [0, 0, 0, 1]
      __SCREAMING_SNAKE_CASE       :Optional[Any]		    =  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"""
from itertools import product



def 					__lowerCamelCase       (							a_					:		int			,       a_					:		int							)      ->				list[int]:
      __SCREAMING_SNAKE_CASE       :Tuple		    =  sides_number
      __SCREAMING_SNAKE_CASE       :List[Any]		    =  max_face_number * dice_number
      __SCREAMING_SNAKE_CASE       :List[Any]		    =  [0] * (max_total + 1)

      __SCREAMING_SNAKE_CASE       :Optional[int]		    =  1
      __SCREAMING_SNAKE_CASE       :Tuple		    =  range(a_			,       max_face_number + 1							)
      for dice_numbers in product(a_			,       repeat=a_							):
            __SCREAMING_SNAKE_CASE       :Any		    =  sum(a_							)
            totals_frequencies[total] += 1

      return totals_frequencies



def 					__lowerCamelCase       (							)      ->				float:
      __SCREAMING_SNAKE_CASE       :Dict		    =  total_frequency_distribution(
          sides_number=4			,       dice_number=9							)
      __SCREAMING_SNAKE_CASE       :Union[str, Any]		    =  total_frequency_distribution(
          sides_number=6			,       dice_number=6							)

      __SCREAMING_SNAKE_CASE       :Optional[Any]		    =  0
      __SCREAMING_SNAKE_CASE       :Any		    =  9
      __SCREAMING_SNAKE_CASE       :List[str]		    =  4 * 9
      __SCREAMING_SNAKE_CASE       :Dict		    =  6
      for peter_total in range(a_			,       max_peter_total + 1							):
            peter_wins_count += peter_totals_frequencies[peter_total] * sum(
                colin_totals_frequencies[min_colin_total:peter_total]							)

      __SCREAMING_SNAKE_CASE       :List[str]		    =  (4**9) * (6**6)
      __SCREAMING_SNAKE_CASE       :Union[str, Any]		    =  peter_wins_count / total_games_number

      __SCREAMING_SNAKE_CASE       :str		    =  round(a_			,       ndigits=7							)

      return rounded_peter_win_probability


if __name__ == "__main__":
  print(f'{solution() = }')