





import math
class      UpperCamelCase_						:




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





def   lowerCamelCase__       (       )     ->	None:



					'''simple docstring'''




					_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(UpperCamelCase__  ):
										for j in range(len(UpperCamelCase__  )  ):
															# training sample
															_snake_case													=			training_samples[j]

															# Compute the winning vector
															_snake_case													=			self_organizing_map.get_winner(UpperCamelCase__    ,      UpperCamelCase__  )

															# Update the winning vector
															_snake_case													=			self_organizing_map.update(UpperCamelCase__    ,      UpperCamelCase__    ,      UpperCamelCase__    ,      UpperCamelCase__  )

    # classify test sample
					_snake_case													=			[0, 0, 0, 1]
					_snake_case													=			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   lowerCamelCase__       (       UpperCamelCase__     :    Tuple    ,      UpperCamelCase__     :    Optional[int]  )     ->	Tuple:



					'''simple docstring'''




					_snake_case													=			[0 for i in range(r + 1  )]
					# nc0 = 1
					_snake_case													=			1
					for i in range(1    ,      n + 1  ):
										# to compute current row from previous row.
										_snake_case													=			min(UpperCamelCase__    ,      UpperCamelCase__  )
										while j > 0:
															c[j] += c[j - 1]
															j -= 1
					return c[r]




print(binomial_coefficient(n=10, r=5))



