


'''simple docstring'''
import os
from collections.abc import Iterator


def 			_lowercase       (				UpperCamelCase__       :					str = "."			):
 for dir_path, dir_names, filenames in os.walk(UpperCamelCase__			):
  __A  :		Dict       =			[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(UpperCamelCase__			)[1] in (".py", ".ipynb"):
    yield os.path.join(UpperCamelCase__,				UpperCamelCase__			).lstrip('./'			)


def 			_lowercase       (				UpperCamelCase__       :					int			):
 return f"""{i * '  '}*""" if i else "\n##"


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


def 			_lowercase       (				UpperCamelCase__       :					str = "."			):
 __A  :		int       =			''
 for filepath in sorted(good_file_paths(UpperCamelCase__			)			):
  __A  :		Optional[Any]       =			os.path.split(UpperCamelCase__			)
  if filepath != old_path:
   __A  :		Optional[int]       =			print_path(UpperCamelCase__,				UpperCamelCase__			)
  __A  :		Dict       =			(filepath.count(os.sep			) + 1) if filepath else 0
  __A  :		Dict       =			f"""{filepath}/{filename}""".replace(' ',				'%20'			)
  __A  :		Dict       =			os.path.splitext(filename.replace('_',				' '			).title()			)[0]
  print(f"""{md_prefix(UpperCamelCase__			)} [{filename}]({url})"""			)


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










'''simple docstring'''
import math

class 						_lowerCamelCase					:




 '''simple docstring'''


 def  snake_case__   (      self      ,      __lowercase      ,      __lowercase						):

  """simple docstring"""







  __A  :		List[str]       =			0.0
  __A  :		Optional[int]       =			0.0
  for i in range(len(__lowercase						)						):
   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  snake_case__   (      self      ,      __lowercase      ,      __lowercase      ,      __lowercase      ,      __lowercase						):

  """simple docstring"""







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


def 			_lowercase       (				):
 # Training Examples ( m, n )
 __A  :		Union[str, Any]       =			[[1, 1, 0, 0], [0, 0, 0, 1], [1, 0, 0, 0], [0, 0, 1, 1]]

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

 # training
 __A  :		Optional[int]       =			SelfOrganizingMap()
 __A  :		int       =			3
 __A  :		Optional[Any]       =			0.5

 for _ in range(UpperCamelCase__			):
  for j in range(len(UpperCamelCase__			)			):
   # training sample
   __A  :		Dict       =			training_samples[j]

   # Compute the winning vector
   __A  :		List[Any]       =			self_organizing_map.get_winner(UpperCamelCase__,				UpperCamelCase__			)

   # Update the winning vector
   __A  :		Union[str, Any]       =			self_organizing_map.update(UpperCamelCase__,				UpperCamelCase__,				UpperCamelCase__,				UpperCamelCase__			)

    # classify test sample
 __A  :		int       =			[0, 0, 0, 1]
 __A  :		List[Any]       =			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()






