
'''simple docstring'''







import math


class 						__UpperCAmelCase      :


							def  lowerCamelCase				(       self    ,   lowerCAmelCase_    ,   lowerCAmelCase_  ):





								"""simple docstring"""






								_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_  ):





								"""simple docstring"""






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

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

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

    # classify test sample
	_snake_case   						=		[0, 0, 0, 1]
	_snake_case   						=		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'''







def 				SCREAMING_SNAKE_CASE__	(   __A = 100	)       ->	int:
	_snake_case   						=		n * (n + 1) * (2 * n + 1) / 6
	_snake_case   						=		(n * (n + 1) / 2) ** 2
	return int(square_of_sum - sum_of_squares	)


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

