code: 
  
  
  
  
  
  
  import argparse
  import json
  import os
  
  import fairseq
  import torch
  from fairseq.data import Dictionary
  
  # Register SEW's fairseq modules
  from sew_asapp import tasks  # noqa: F401
  
  from transformers import (
      SEWDConfig,
      SEWDForCTC,
      SEWDModel,
      WavaVecaCTCTokenizer,
      WavaVecaFeatureExtractor,
      WavaVecaProcessor,
      logging,
  )
  
  
  logging.set_verbosity_info()
  __snake_case							      =						logging.get_logger(__name__)
  
  __snake_case							      =						{
      """post_extract_proj""": """feature_projection""",
      """encoder.pos_conv.0""": """encoder.pos_conv_embed.conv""",
      """attention.self.query_proj""": """encoder.encoder.layer.*.attention.self.query_proj""",
      """attention.self.key_proj""": """encoder.encoder.layer.*.attention.self.key_proj""",
      """attention.self.value_proj""": """encoder.encoder.layer.*.attention.self.value_proj""",
      """attention.output.dense""": """encoder.encoder.layer.*.attention.output.dense""",
      """attention.output.LayerNorm""": """encoder.encoder.layer.*.attention.output.LayerNorm""",
      """intermediate.dense""": """encoder.encoder.layer.*.intermediate.dense""",
      """output.dense""": """encoder.encoder.layer.*.output.dense""",
      """output.LayerNorm""": """encoder.encoder.layer.*.output.LayerNorm""",
      """encoder.encoder.rel_embeddings""": """encoder.encoder.rel_embeddings""",
      """encoder.encoder.LayerNorm""": """encoder.encoder.LayerNorm""",
      """encoder.upsample.0""": """encoder.upsample.projection""",
      """encoder.layer_norm""": """encoder.layer_norm""",
      """w2v_model.layer_norm""": """layer_norm""",
      """w2v_encoder.proj""": """lm_head""",
      """mask_emb""": """masked_spec_embed""",
  }
  
  
  def 						_A     (       SCREAMING_SNAKE_CASE__						:			str  ,						SCREAMING_SNAKE_CASE__						:			Dict  ,						SCREAMING_SNAKE_CASE__						:			Optional[int]  ,						SCREAMING_SNAKE_CASE__						:			Dict  ,						SCREAMING_SNAKE_CASE__						:			Optional[int] ):
      for attribute in key.split('''.''' ):
          UpperCamelCase :List[Any]										=     getattr(SCREAMING_SNAKE_CASE__  ,						SCREAMING_SNAKE_CASE__ )
  
      if weight_type is not None:
          UpperCamelCase :Dict										=     getattr(SCREAMING_SNAKE_CASE__  ,						SCREAMING_SNAKE_CASE__ ).shape
      else:
          UpperCamelCase :int										=     hf_pointer.shape
  
      assert hf_shape == value.shape, (
          F'''Shape of hf {key + "." + weight_type if weight_type is not None else ""} is {hf_shape}, but should be'''
          F''' {value.shape} for {full_name}'''
      )
  
      if weight_type == "weight":
          UpperCamelCase :Any										=     value
      elif weight_type == "weight_g":
          UpperCamelCase :List[Any]										=     value
      elif weight_type == "weight_v":
          UpperCamelCase :str										=     value
      elif weight_type == "bias":
          UpperCamelCase :List[str]										=     value
      else:
          UpperCamelCase :Tuple										=     value
  
      logger.info(F'''{key + "." + weight_type if weight_type is not None else ""} was initialized from {full_name}.''' )
  
  
  def 						_A     (       SCREAMING_SNAKE_CASE__						:			Optional[Any]  ,						SCREAMING_SNAKE_CASE__						:			List[str]  ,						SCREAMING_SNAKE_CASE__						:			Tuple ):
      UpperCamelCase :List[Any]										=     []
      UpperCamelCase :Tuple										=     fairseq_model.state_dict()
  
      UpperCamelCase :Tuple										=     hf_model.sew_d.feature_extractor if is_finetuned else hf_model.feature_extractor
  
      for name, value in fairseq_dict.items():
          UpperCamelCase :List[Any]										=     False
          if "conv_layers" in name:
              load_conv_layer(
                  SCREAMING_SNAKE_CASE__  ,						SCREAMING_SNAKE_CASE__  ,						SCREAMING_SNAKE_CASE__  ,						SCREAMING_SNAKE_CASE__  ,						hf_model.config.feat_extract_norm == '''group'''  ,						)
              UpperCamelCase :List[str]										=     True
          else:
              for key, mapped_key in MAPPING.items():
                  UpperCamelCase :Optional[int]										=     '''sew_d.''' + mapped_key if (is_finetuned and mapped_key != '''lm_head''') else mapped_key
  
                  if key in name or key.split('''w2v_model.''' )[-1] == name.split('''.''' )[0]:
                      UpperCamelCase :List[str]										=     True
                      if "*" in mapped_key:
                          UpperCamelCase :Optional[Any]										=     name.split(SCREAMING_SNAKE_CASE__ )[0].split('''.''' )[-2]
                          if not layer_index.isnumeric():
                              continue
                          UpperCamelCase :Optional[Any]										=     mapped_key.replace('''*'''  ,						SCREAMING_SNAKE_CASE__ )
                      if "weight_g" in name:
                          UpperCamelCase :int										=     '''weight_g'''
                      elif "weight_v" in name:
                          UpperCamelCase :Union[str, Any]										=     '''weight_v'''
                      elif "weight" in name:
                          UpperCamelCase :Dict										=     '''weight'''
                      elif "bias" in name:
                          UpperCamelCase :Any										=     '''bias'''
                      else:
                          UpperCamelCase :str										=     None
                      set_recursively(SCREAMING_SNAKE_CASE__  ,						SCREAMING_SNAKE_CASE__  ,						SCREAMING_SNAKE_CASE__  ,						SCREAMING_SNAKE_CASE__  ,						SCREAMING_SNAKE_CASE__ )
                  continue
          if not is_used:
              unused_weights.append(SCREAMING_SNAKE_CASE__ )
  
      logger.warning(F'''Unused weights: {unused_weights}''' )
  
  
  def 						_A     (       SCREAMING_SNAKE_CASE__						:			str  ,						SCREAMING_SNAKE_CASE__						:			str  ,						SCREAMING_SNAKE_CASE__						:			str  ,						SCREAMING_SNAKE_CASE__						:			Tuple  ,						SCREAMING_SNAKE_CASE__						:			Any ):
      UpperCamelCase :Tuple										=     full_name.split('''conv_layers.''' )[-1]
      UpperCamelCase :Union[str, Any]										=     name.split('''.''' )
      UpperCamelCase :Dict										=     int(items[0] )
      UpperCamelCase :Any										=     int(items[1] )
  
      if type_id == 0:
          if "bias" in name:
              assert value.shape == feature_extractor.conv_layers[layer_id].conv.bias.data.shape, (
                  F'''{full_name} has size {value.shape}, but'''
                  F''' {feature_extractor.conv_layers[layer_id].conv.bias.data.shape} was found.'''
              )
              UpperCamelCase :Optional[int]										=     value
              logger.info(F'''Feat extract conv layer {layer_id} was initialized from {full_name}.''' )
          elif "weight" in name:
              assert value.shape == feature_extractor.conv_layers[layer_id].conv.weight.data.shape, (
                  F'''{full_name} has size {value.shape}, but'''
                  F''' {feature_extractor.conv_layers[layer_id].conv.weight.data.shape} was found.'''
              )
              UpperCamelCase :Any										=     value
              logger.info(F'''Feat extract conv layer {layer_id} was initialized from {full_name}.''' )
      elif (type_id == 2 and not use_group_norm) or (type_id == 2 and layer_id == 0 and use_group_norm):
          if "bias" in name:
              assert value.shape == feature_extractor.conv_layers[layer_id].layer_norm.bias.data.shape, (
                  F'''{full_name} has size {value.shape}, but {feature_extractor[layer_id].layer_norm.bias.data.shape} was'''
                  " found."
              )
              UpperCamelCase :int										=     value
              logger.info(F'''Feat extract layer norm weight of layer {layer_id} was initialized from {full_name}.''' )
          elif "weight" in name:
              assert value.shape == feature_extractor.conv_layers[layer_id].layer_norm.weight.data.shape, (
                  F'''{full_name} has size {value.shape}, but'''
                  F''' {feature_extractor[layer_id].layer_norm.weight.data.shape} was found.'''
              )
              UpperCamelCase :Optional[Any]										=     value
              logger.info(F'''Feat extract layer norm weight of layer {layer_id} was initialized from {full_name}.''' )
      else:
          unused_weights.append(SCREAMING_SNAKE_CASE__ )
  
  
  def 						_A     (       SCREAMING_SNAKE_CASE__						:			str  ,						SCREAMING_SNAKE_CASE__						:			Any ):
      UpperCamelCase :Any										=     SEWDConfig()
      if is_finetuned:
          UpperCamelCase :List[Any]										=     model.wav_encoder.wav_model.cfg
      else:
          UpperCamelCase :Dict										=     model.cfg
  
      UpperCamelCase :Any										=     fs_config.conv_bias
      UpperCamelCase :List[Any]										=     eval(fs_config.conv_feature_layers )
      UpperCamelCase :Optional[int]										=     [x[0] for x in conv_layers]
      UpperCamelCase :List[str]										=     [x[1] for x in conv_layers]
      UpperCamelCase :Optional[Any]										=     [x[2] for x in conv_layers]
      UpperCamelCase :Any										=     '''gelu'''
      UpperCamelCase :Tuple										=     '''layer''' if fs_config.extractor_mode == '''layer_norm''' else '''group'''
      UpperCamelCase :Optional[int]										=     0.0
      UpperCamelCase :Tuple										=     fs_config.activation_fn.name
      UpperCamelCase :Optional[Any]										=     fs_config.encoder_embed_dim
      UpperCamelCase :Optional[Any]										=     0.02
      UpperCamelCase :Optional[Any]										=     fs_config.encoder_ffn_embed_dim
      UpperCamelCase :Optional[Any]										=     1e-5
      UpperCamelCase :Optional[Any]										=     fs_config.encoder_layerdrop
      UpperCamelCase :Dict										=     fs_config.encoder_attention_heads
      UpperCamelCase :List[str]										=     fs_config.conv_pos_groups
      UpperCamelCase :Union[str, Any]										=     fs_config.conv_pos
      UpperCamelCase :Tuple										=     len(SCREAMING_SNAKE_CASE__ )
      UpperCamelCase :List[Any]										=     fs_config.encoder_layers
      UpperCamelCase :Optional[Any]										=     fs_config.squeeze_factor
      # DeBERTa-specific parameters:
      UpperCamelCase :List[str]										=     fs_config.max_position_embeddings
      UpperCamelCase :str										=     fs_config.position_buckets
      UpperCamelCase :int										=     fs_config.share_att_key
      UpperCamelCase :Dict										=     fs_config.relative_attention
      UpperCamelCase :List[Any]										=     fs_config.position_biased_input
      UpperCamelCase :Optional[Any]										=     tuple(fs_config.pos_att_type.split('''|''' ) )
      UpperCamelCase :str										=     fs_config.norm_rel_ebd
  
      # take care of any params that are overridden by the Wav2VecCtc model
      if is_finetuned:
          UpperCamelCase :Tuple										=     model.cfg
          UpperCamelCase :Tuple										=     fs_config.final_dropout
          UpperCamelCase :Any										=     fs_config.layerdrop
      UpperCamelCase :List[Any]										=     fs_config.activation_dropout
      UpperCamelCase :Any										=     fs_config.mask_prob > 0 or fs_config.mask_channel_prob > 0
      UpperCamelCase :Optional[Any]										=     fs_config.attention_dropout
      UpperCamelCase :Dict										=     fs_config.dropout_input
      UpperCamelCase :int										=     fs_config.dropout
      UpperCamelCase :int										=     fs_config.mask_channel_length
      UpperCamelCase :Dict										=     fs_config.mask_channel_prob
      UpperCamelCase :Union[str, Any]										=     fs_config.mask_length
      UpperCamelCase :List[str]										=     fs_config.mask_prob
  
      UpperCamelCase :int										=     '''Wav2Vec2FeatureExtractor'''
      UpperCamelCase :int										=     '''Wav2Vec2CTCTokenizer'''
  
      return config
  
  
  @torch.no_grad()
  def 						_A     (       SCREAMING_SNAKE_CASE__						:			str  ,						SCREAMING_SNAKE_CASE__						:			Optional[int]  ,						SCREAMING_SNAKE_CASE__						:			Any=None  ,						SCREAMING_SNAKE_CASE__						:			List[str]=None  ,						SCREAMING_SNAKE_CASE__						:			Any=True ):
  
      if is_finetuned:
          UpperCamelCase :str										=     fairseq.checkpoint_utils.load_model_ensemble_and_task(
              [checkpoint_path]  ,						arg_overrides={'''data''': '''/'''.join(dict_path.split('''/''' )[:-1] )} )
      else:
          UpperCamelCase :Union[str, Any]										=     fairseq.checkpoint_utils.load_model_ensemble_and_task([checkpoint_path] )
  
      if config_path is not None:
          UpperCamelCase :str										=     SEWDConfig.from_pretrained(SCREAMING_SNAKE_CASE__ )
      else:
          UpperCamelCase :Tuple										=     convert_config(model[0]  ,						SCREAMING_SNAKE_CASE__ )
      UpperCamelCase :str										=     model[0].eval()
  
      UpperCamelCase :Tuple										=     True if config.feat_extract_norm == '''layer''' else False
      UpperCamelCase :Dict										=     WavaVecaFeatureExtractor(
          feature_size=1  ,						sampling_rate=16000  ,						padding_value=0  ,						do_normalize=SCREAMING_SNAKE_CASE__  ,						return_attention_mask=SCREAMING_SNAKE_CASE__  ,						)
  
      if is_finetuned:
          if dict_path:
              UpperCamelCase :Tuple										=     Dictionary.load(SCREAMING_SNAKE_CASE__ )
  
              # important change bos & pad token id since CTC symbol is <pad> and
              # not <s> as in fairseq
              UpperCamelCase :int										=     target_dict.pad_index
              UpperCamelCase :Union[str, Any]										=     target_dict.bos_index
              UpperCamelCase :Dict										=     target_dict.pad_index
              UpperCamelCase :Optional[int]										=     target_dict.bos_index
              UpperCamelCase :Optional[Any]										=     target_dict.eos_index
              UpperCamelCase :List[str]										=     len(target_dict.symbols )
              UpperCamelCase :Dict										=     os.path.join(SCREAMING_SNAKE_CASE__  ,						'''vocab.json''' )
              if not os.path.isdir(SCREAMING_SNAKE_CASE__ ):
                  logger.error('''--pytorch_dump_folder_path ({}) should be a directory'''.format(SCREAMING_SNAKE_CASE__ ) )
                  return
              os.makedirs(SCREAMING_SNAKE_CASE__  ,						exist_ok=SCREAMING_SNAKE_CASE__ )
              with open(SCREAMING_SNAKE_CASE__  ,						'''w'''  ,						encoding='''utf-8''' ) as vocab_handle:
                  json.dump(target_dict.indices  ,						SCREAMING_SNAKE_CASE__ )
              UpperCamelCase :Dict										=     WavaVecaCTCTokenizer(
                  SCREAMING_SNAKE_CASE__  ,						unk_token=target_dict.unk_word  ,						pad_token=target_dict.pad_word  ,						bos_token=target_dict.bos_word  ,						eos_token=target_dict.eos_word  ,						word_delimiter_token='''|'''  ,						do_lower_case=SCREAMING_SNAKE_CASE__  ,						)
              UpperCamelCase :Optional[int]										=     WavaVecaProcessor(feature_extractor=SCREAMING_SNAKE_CASE__  ,						tokenizer=SCREAMING_SNAKE_CASE__ )
              processor.save_pretrained(SCREAMING_SNAKE_CASE__ )
  
          UpperCamelCase :Tuple										=     SEWDForCTC(SCREAMING_SNAKE_CASE__ )
      else:
          UpperCamelCase :List[str]										=     SEWDModel(SCREAMING_SNAKE_CASE__ )
          feature_extractor.save_pretrained(SCREAMING_SNAKE_CASE__ )
  
      recursively_load_weights(SCREAMING_SNAKE_CASE__  ,						SCREAMING_SNAKE_CASE__  ,						SCREAMING_SNAKE_CASE__ )
  
      hf_model.save_pretrained(SCREAMING_SNAKE_CASE__ )
  
  
  if __name__ == "__main__":
   __snake_case							      =						argparse.ArgumentParser()
   parser.add_argument("""--pytorch_dump_folder_path""", default=None, type=str, help="""Path to the output PyTorch model.""")
   parser.add_argument("""--checkpoint_path""", default=None, type=str, help="""Path to fairseq checkpoint""")
   parser.add_argument("""--dict_path""", default=None, type=str, help="""Path to dict of fine-tuned model""")
   parser.add_argument("""--config_path""", default=None, type=str, help="""Path to hf config.json of model to convert""")
   parser.add_argument(
       """--is_finetuned""", action="""store_true""", help="""Whether the model to convert is a fine-tuned model or not"""
   )
   __snake_case							      =						parser.parse_args()
   convert_sew_checkpoint(
       args.checkpoint_path, args.pytorch_dump_folder_path, args.config_path, args.dict_path, args.is_finetuned
   )
  
  
  
  
style_context: 
  
  
  
  
  
  
  from collections.abc import Callable
  from math import log
  from os import name, system
  from random import gauss, seed
  from typing import TypeVar
  
  
  def 						_A     (       SCREAMING_SNAKE_CASE__						:			float  ,						SCREAMING_SNAKE_CASE__						:			float  ,						SCREAMING_SNAKE_CASE__						:			int ):
      seed(1 )
      return [gauss(SCREAMING_SNAKE_CASE__  ,						SCREAMING_SNAKE_CASE__ ) for _ in range(SCREAMING_SNAKE_CASE__ )]
  
  
  def 						_A     (       SCREAMING_SNAKE_CASE__						:			int  ,						SCREAMING_SNAKE_CASE__						:			list ):
      return [k for k in range(SCREAMING_SNAKE_CASE__ ) for _ in range(instance_count[k] )]
  
  
  def 						_A     (       SCREAMING_SNAKE_CASE__						:			int  ,						SCREAMING_SNAKE_CASE__						:			list ):
      return sum(SCREAMING_SNAKE_CASE__ ) / instance_count
  
  
  def 						_A     (       SCREAMING_SNAKE_CASE__						:			int  ,						SCREAMING_SNAKE_CASE__						:			int ):
      return instance_count / total_count
  
  
  def 						_A     (       SCREAMING_SNAKE_CASE__						:			list  ,						SCREAMING_SNAKE_CASE__						:			list  ,						SCREAMING_SNAKE_CASE__						:			int ):
      UpperCamelCase :Optional[Any]										=     []  # An empty list to store all squared differences
      # iterate over number of elements in items
      for i in range(len(SCREAMING_SNAKE_CASE__ ) ):
          # for loop iterates over number of elements in inner layer of items
          for j in range(len(items[i] ) ):
              # appending squared differences to 'squared_diff' list
              squared_diff.append((items[i][j] - means[i]) ** 2 )
  
      # one divided by (the number of all instances - number of classes) multiplied by
      # sum of all squared differences
      UpperCamelCase :Tuple										=     len(SCREAMING_SNAKE_CASE__ )  # Number of classes in dataset
      return 1 / (total_count - n_classes) * sum(SCREAMING_SNAKE_CASE__ )
  
  
  def 						_A     (       SCREAMING_SNAKE_CASE__						:			list  ,						SCREAMING_SNAKE_CASE__						:			list  ,						SCREAMING_SNAKE_CASE__						:			float  ,						SCREAMING_SNAKE_CASE__						:			list ):
      UpperCamelCase :Dict										=     []
      # for loop iterates over number of elements in list
      for i in range(len(SCREAMING_SNAKE_CASE__ ) ):
          # for loop iterates over number of inner items of each element
          for j in range(len(x_items[i] ) ):
              UpperCamelCase :List[Any]										=     []  # to store all discriminant values of each item as a list
              # for loop iterates over number of classes we have in our dataset
              for k in range(len(SCREAMING_SNAKE_CASE__ ) ):
                  # appending values of discriminants for each class to 'temp' list
                  temp.append(
                      x_items[i][j] * (means[k] / variance)
                      - (means[k] ** 2 / (2 * variance))
                      + log(probabilities[k] ) )
              # appending discriminant values of each item to 'results' list
              results.append(SCREAMING_SNAKE_CASE__ )
  
      return [result.index(max(SCREAMING_SNAKE_CASE__ ) ) for result in results]
  
  
  def 						_A     (       SCREAMING_SNAKE_CASE__						:			list  ,						SCREAMING_SNAKE_CASE__						:			list ):
      UpperCamelCase :List[Any]										=     sum(1 for i, j in zip(SCREAMING_SNAKE_CASE__  ,						SCREAMING_SNAKE_CASE__ ) if i == j )
      # percentage of accuracy equals to number of correct predictions divided by number
      # of all data and multiplied by 100
      return (correct / len(SCREAMING_SNAKE_CASE__ )) * 100
  
  
  __snake_case							      =						TypeVar("""num""")
  
  
  def 						_A     (       SCREAMING_SNAKE_CASE__						:			Callable[[object], num]  ,						SCREAMING_SNAKE_CASE__						:			str  ,						SCREAMING_SNAKE_CASE__						:			str  ,						SCREAMING_SNAKE_CASE__						:			Callable[[num], bool] = lambda SCREAMING_SNAKE_CASE__ : True  ,						SCREAMING_SNAKE_CASE__						:			str | None = None  ,						):
      while True:
          try:
              UpperCamelCase :List[Any]										=     input_type(input(SCREAMING_SNAKE_CASE__ ).strip() or default )
              if condition(SCREAMING_SNAKE_CASE__ ):
                  return user_input
              else:
                  print(F'''{user_input}: {err_msg}''' )
                  continue
          except ValueError:
              print(
                  F'''{user_input}: Incorrect input type, expected {input_type.__name__!r}''' )
  
  
  def 						_A     (       ):
      while True:
          print(''' Linear Discriminant Analysis '''.center(50  ,						'''*''' ) )
          print('''*''' * 50  ,						'''\n''' )
          print('''First of all we should specify the number of classes that''' )
          print('''we want to generate as training dataset''' )
          # Trying to get number of classes
          UpperCamelCase :List[Any]										=     valid_input(
              input_type=SCREAMING_SNAKE_CASE__  ,						condition=lambda SCREAMING_SNAKE_CASE__ : x > 0  ,						input_msg='''Enter the number of classes (Data Groupings): '''  ,						err_msg='''Number of classes should be positive!'''  ,						)
  
          print('''-''' * 100 )
  
          # Trying to get the value of standard deviation
          UpperCamelCase :Any										=     valid_input(
              input_type=SCREAMING_SNAKE_CASE__  ,						condition=lambda SCREAMING_SNAKE_CASE__ : x >= 0  ,						input_msg=(
                  '''Enter the value of standard deviation'''
                  '''(Default value is 1.0 for all classes): '''
              )  ,						err_msg='''Standard deviation should not be negative!'''  ,						default='''1.0'''  ,						)
  
          print('''-''' * 100 )
  
          # Trying to get number of instances in classes and theirs means to generate
          # dataset
          UpperCamelCase :Tuple										=     []  # An empty list to store instance counts of classes in dataset
          for i in range(SCREAMING_SNAKE_CASE__ ):
              UpperCamelCase :List[Any]										=     valid_input(
                  input_type=SCREAMING_SNAKE_CASE__  ,						condition=lambda SCREAMING_SNAKE_CASE__ : x > 0  ,						input_msg=(F'''Enter The number of instances for class_{i+1}: ''')  ,						err_msg='''Number of instances should be positive!'''  ,						)
              counts.append(SCREAMING_SNAKE_CASE__ )
          print('''-''' * 100 )
  
          # An empty list to store values of user-entered means of classes
          UpperCamelCase :Union[str, Any]										=     []
          for a in range(SCREAMING_SNAKE_CASE__ ):
              UpperCamelCase :str										=     valid_input(
                  input_type=SCREAMING_SNAKE_CASE__  ,						input_msg=(F'''Enter the value of mean for class_{a+1}: ''')  ,						err_msg='''This is an invalid value.'''  ,						)
              user_means.append(SCREAMING_SNAKE_CASE__ )
          print('''-''' * 100 )
  
          print('''Standard deviation: '''  ,						SCREAMING_SNAKE_CASE__ )
          # print out the number of instances in classes in separated line
          for i, count in enumerate(SCREAMING_SNAKE_CASE__  ,						1 ):
              print(F'''Number of instances in class_{i} is: {count}''' )
          print('''-''' * 100 )
  
          # print out mean values of classes separated line
          for i, user_mean in enumerate(SCREAMING_SNAKE_CASE__  ,						1 ):
              print(F'''Mean of class_{i} is: {user_mean}''' )
          print('''-''' * 100 )
  
          # Generating training dataset drawn from gaussian distribution
          UpperCamelCase :Tuple										=     [
              gaussian_distribution(user_means[j]  ,						SCREAMING_SNAKE_CASE__  ,						counts[j] )
              for j in range(SCREAMING_SNAKE_CASE__ )
          ]
          print('''Generated Normal Distribution: \n'''  ,						SCREAMING_SNAKE_CASE__ )
          print('''-''' * 100 )
  
          # Generating Ys to detecting corresponding classes
          UpperCamelCase :int										=     y_generator(SCREAMING_SNAKE_CASE__  ,						SCREAMING_SNAKE_CASE__ )
          print('''Generated Corresponding Ys: \n'''  ,						SCREAMING_SNAKE_CASE__ )
          print('''-''' * 100 )
  
          # Calculating the value of actual mean for each class
          UpperCamelCase :Tuple										=     [calculate_mean(counts[k]  ,						x[k] ) for k in range(SCREAMING_SNAKE_CASE__ )]
          # for loop iterates over number of elements in 'actual_means' list and print
          # out them in separated line
          for i, actual_mean in enumerate(SCREAMING_SNAKE_CASE__  ,						1 ):
              print(F'''Actual(Real) mean of class_{i} is: {actual_mean}''' )
          print('''-''' * 100 )
  
          # Calculating the value of probabilities for each class
          UpperCamelCase :Dict										=     [
              calculate_probabilities(counts[i]  ,						sum(SCREAMING_SNAKE_CASE__ ) ) for i in range(SCREAMING_SNAKE_CASE__ )
          ]
  
          # for loop iterates over number of elements in 'probabilities' list and print
          # out them in separated line
          for i, probability in enumerate(SCREAMING_SNAKE_CASE__  ,						1 ):
              print(F'''Probability of class_{i} is: {probability}''' )
          print('''-''' * 100 )
  
          # Calculating the values of variance for each class
          UpperCamelCase :int										=     calculate_variance(SCREAMING_SNAKE_CASE__  ,						SCREAMING_SNAKE_CASE__  ,						sum(SCREAMING_SNAKE_CASE__ ) )
          print('''Variance: '''  ,						SCREAMING_SNAKE_CASE__ )
          print('''-''' * 100 )
  
          # Predicting Y values
          # storing predicted Y values in 'pre_indexes' variable
          UpperCamelCase :Any										=     predict_y_values(SCREAMING_SNAKE_CASE__  ,						SCREAMING_SNAKE_CASE__  ,						SCREAMING_SNAKE_CASE__  ,						SCREAMING_SNAKE_CASE__ )
          print('''-''' * 100 )
  
          # Calculating Accuracy of the model
          print(F'''Accuracy: {accuracy(SCREAMING_SNAKE_CASE__  ,						SCREAMING_SNAKE_CASE__ )}''' )
          print('''-''' * 100 )
          print(''' DONE '''.center(100  ,						'''+''' ) )
  
          if input('''Press any key to restart or \'q\' for quit: ''' ).strip().lower() == "q":
              print('''\n''' + '''GoodBye!'''.center(100  ,						'''-''' ) + '''\n''' )
              break
          system('''cls''' if name == '''nt''' else '''clear''' )  # noqa: S605
  
  
  if __name__ == "__main__":
   main()
  
  
  
  
  
  