





import os
from collections.abc import Iterator




def 				snake_case_      (		SCREAMING_SNAKE_CASE__ = "."       ):







  '''simple docstring'''



  for dir_path, dir_names, filenames in os.walk(SCREAMING_SNAKE_CASE__       ):
    _snake_case     		=				[d for d in dir_names if d != """scripts""" and d[0] not in """._"""]
    for filename in filenames:
      if filename == "__init__.py":
        continue
      if os.path.splitext(SCREAMING_SNAKE_CASE__       )[1] in (".py", ".ipynb"):
        yield os.path.join(SCREAMING_SNAKE_CASE__					,	SCREAMING_SNAKE_CASE__       ).lstrip("./"       )




def 				snake_case_      (		SCREAMING_SNAKE_CASE__       ):







  '''simple docstring'''



  return f'''{i * "  "}*''' if i else "\n##"




def 				snake_case_      (		SCREAMING_SNAKE_CASE__					,	SCREAMING_SNAKE_CASE__       ):







  '''simple docstring'''



  _snake_case     		=				old_path.split(os.sep       )
  for i, new_part in enumerate(new_path.split(os.sep       )       ):
    if (i + 1 > len(SCREAMING_SNAKE_CASE__       ) or old_parts[i] != new_part) and new_part:
      print(f'''{md_prefix(SCREAMING_SNAKE_CASE__       )} {new_part.replace("_"					,	" "       ).title()}'''       )
  return new_path




def 				snake_case_      (		SCREAMING_SNAKE_CASE__ = "."       ):







  '''simple docstring'''



  _snake_case     		=				""""""
  for filepath in sorted(good_file_paths(SCREAMING_SNAKE_CASE__       )       ):
    _snake_case     		=				os.path.split(SCREAMING_SNAKE_CASE__       )
    if filepath != old_path:
      _snake_case     		=				print_path(SCREAMING_SNAKE_CASE__					,	SCREAMING_SNAKE_CASE__       )
    _snake_case     		=				(filepath.count(os.sep       ) + 1) if filepath else 0
    _snake_case     		=				f'''{filepath}/{filename}'''.replace(" "					,	"%20"       )
    _snake_case     		=				os.path.splitext(filename.replace("_"					,	" "       ).title()       )[0]
    print(f'''{md_prefix(SCREAMING_SNAKE_CASE__       )} [{filename}]({url})'''       )


if __name__ == "__main__":
 print_directory_md(""".""")









'''simple docstring'''



import math


class       __SCREAMING_SNAKE_CASE	:



     '''simple docstring'''






     def 	UpperCamelCase(					self						,   lowerCamelCase						,   lowerCamelCase	):
       _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 	UpperCamelCase(					self						,   lowerCamelCase						,   lowerCamelCase						,   lowerCamelCase						,   lowerCamelCase	):
       for i in range(len(lowerCamelCase	)	):
         weights[j][i] += alpha * (sample[i] - weights[j][i])
       return weights







def 				snake_case_      (		):







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

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

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

    # classify test sample
  _snake_case     		=				[0, 0, 0, 1]
  _snake_case     		=				self_organizing_map.get_winner(SCREAMING_SNAKE_CASE__					,	SCREAMING_SNAKE_CASE__       )

  # 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()


