'''simple docstring'''




import math




class    a__				:






     def        SCREAMING_SNAKE_CASE__       (			self		:		List[str]  ,    a		:		list[list[float]]  ,    a		:		list[int]   ):





         """simple docstring"""



         __lowerCamelCase          =  0.0
         __lowerCamelCase          =  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		:		Union[str, Any]  ,    a		:		list[list[int | float]]  ,    a		:		list[int]  ,    a		:		int  ,    a		:		float   ):





         """simple docstring"""



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






def __lowerCAmelCase			(							)     ->   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()

'''simple docstring'''




from __future__ import annotations

from typing import Any






def __lowerCAmelCase			(							UpperCamelCase__    )     ->   None:
    create_state_space_tree(UpperCamelCase__    ,  []    ,  0    )






def __lowerCAmelCase			(							UpperCamelCase__    ,  UpperCamelCase__    ,  UpperCamelCase__    )     ->   None:

    if index == len(UpperCamelCase__    ):
        print(UpperCamelCase__    )
        return

    create_state_space_tree(UpperCamelCase__    ,  UpperCamelCase__    ,  index + 1    )
    current_subsequence.append(sequence[index]    )
    create_state_space_tree(UpperCamelCase__    ,  UpperCamelCase__    ,  index + 1    )
    current_subsequence.pop()


if __name__ == "__main__":
  __UpperCAmelCase												=[3, 1, 2, 4]
  generate_all_subsequences(seq)

  seq.clear()
  seq.extend(["A", "B", "C"])
  generate_all_subsequences(seq)
