code: 
  
  
  
  
  
  
  import logging
  import os
  import sys
  from dataclasses import dataclass, field
  from typing import List, Optional
  
  import torch
  from datasets import Dataset
  from torch import nn
  from tqdm.auto import tqdm
  
  from transformers import (
      AutoModelForSequenceClassification,
      AutoTokenizer,
      HfArgumentParser,
      Trainer,
      TrainingArguments,
      set_seed,
      utils,
  )
  from transformers.trainer_utils import get_last_checkpoint, is_main_process
  
  
  __snake_case							      =						"""
  Distills an NLI-based zero-shot classifier to a smaller, more efficient model with a fixed set of candidate class
  names. Useful for speeding up zero-shot classification in cases where labeled training data is not available, but
  when only a single fixed set of classes is needed. Takes a teacher NLI model, student classifier model, unlabeled
  dataset, and set of K possible class names. Yields a single classifier with K outputs corresponding to the provided
  class names.
  """
  
  __snake_case							      =						logging.getLogger(__name__)
  
  
  
  
  
  
  
  @dataclass
  class     UpperCAmelCase_		:
  
  
  
        """simple docstring"""
        UpperCamelCase_       :      Optional[str]     =field(
            default='roberta-large-mnli',			metadata={'help': 'The NLI/zero-shot teacher model to be distilled.'}				)
        UpperCamelCase_       :      Optional[str]     =field(
            default='This example is {}.',			metadata={
                'help': (
                    'Template used to turn class names into mock hypotheses for teacher NLI model. Must include {{}}'
                    'where class name is inserted.'
                )
            },			)
        UpperCamelCase_       :      Optional[int]     =field(
            default=32,			metadata={'help': 'Batch size for generating teacher predictions.'}				)
        UpperCamelCase_       :      Optional[bool]     =field(
            default=lowercase,			metadata={
                'help': (
                    'Allow multiple classes to be true rather than forcing them to sum to 1 (sometimes called'
                    'multi-class multi-label classification).'
                )
            },			)
        UpperCamelCase_       :      Optional[float]     =field(
            default=1.0,			metadata={'help': 'Temperature applied to teacher softmax for distillation.'}				)
  
  
  
  
  
  
  
  @dataclass
  class     UpperCAmelCase_		:
  
  
  
        """simple docstring"""
        UpperCamelCase_       :      Optional[str]     =field(
            default='distilbert-base-uncased',			metadata={'help': 'The NLI/zero-shot teacher model to be distilled.'}				)
  
  
  
  
  
  
  
  @dataclass
  class     UpperCAmelCase_		:
  
  
  
        """simple docstring"""
        UpperCamelCase_       :      str     =field(metadata={'help': 'Text file with one unlabeled instance per line.'}				)
        UpperCamelCase_       :      str     =field(metadata={'help': 'Text file with one class name per line.'}				)
        UpperCamelCase_       :      bool     =field(
            default=lowercase,			metadata={'help': 'Whether to use one of the fast tokenizer (backed by the Rust tokenizers library) or not.'},			)
  
  
  
  
  
  
  
  @dataclass
  class     UpperCAmelCase_		(      lowercase				):
  
  
  
        """simple docstring"""
        UpperCamelCase_       :      Optional[str]     =field(
            default=lowercase,			metadata={'help': 'The output directory where the model predictions and checkpoints will be written.'},			)
        UpperCamelCase_       :      int     =field(
            default=32,			metadata={'help': 'Batch size per GPU/TPU core/CPU for training.'}				)
        UpperCamelCase_       :      int     =field(
            default=128,			metadata={'help': 'Batch size per GPU/TPU core/CPU for evaluation.'}				)
        UpperCamelCase_       :      float     =field(default=1.0,			metadata={'help': 'Total number of training epochs to perform.'}				)
        UpperCamelCase_       :      bool     =field(default=lowercase,			metadata={'help': 'Whether to run training of student model.'}				)
        UpperCamelCase_       :      bool     =field(
            default=lowercase,			metadata={
                'help': (
                    'Whether to evaluate the agreement of the final student predictions and the teacher predictions'
                    'after training.'
                )
            },			)
        UpperCamelCase_       :      Optional[int]     =field(
            default=0,			metadata={
                'help': (
                    'Limit the total amount of checkpoints.'
                    'Deletes the older checkpoints in the output_dir. Default is 0 (no checkpoints).'
                )
            },			)
  
  
  
  
  
  
  
  class     UpperCAmelCase_		(      lowercase				):
  
  
  
        """simple docstring"""
        def 					UpperCAmelCase		(       self					,       SCREAMING_SNAKE_CASE_					,       SCREAMING_SNAKE_CASE_					,       SCREAMING_SNAKE_CASE_=False				)       ->   List[Any]:
            UpperCamelCase :Any										=     inputs['''labels''']
            UpperCamelCase :Optional[int]										=     model(inputs['''input_ids''']					,       attention_mask=inputs['''attention_mask''']				)
            UpperCamelCase :Any										=     outputs[0]
  
            UpperCamelCase :Union[str, Any]										=     -torch.sum(target_p * logits.log_softmax(dim=-1				)					,       axis=-1				).mean()
  
            if return_outputs:
                return loss, outputs
  
            return loss
  
  
  
  
  
  
  
  def 						_A     (       SCREAMING_SNAKE_CASE__						:			List[Any] ):
      UpperCamelCase :List[Any]										=     []
      with open(SCREAMING_SNAKE_CASE__  ,						'''r''' ) as f:
          for line in f:
              UpperCamelCase :Optional[int]										=     line.strip()
              if len(SCREAMING_SNAKE_CASE__ ) > 0:
                  lines.append(SCREAMING_SNAKE_CASE__ )
      return lines
  
  
  def 						_A     (       SCREAMING_SNAKE_CASE__						:			Optional[int]  ,						SCREAMING_SNAKE_CASE__						:			Any  ,						SCREAMING_SNAKE_CASE__						:			Optional[int] ):
      UpperCamelCase :Optional[int]										=     []
      UpperCamelCase :Any										=     []
      for example in examples:
          for name in class_names:
              premises.append(SCREAMING_SNAKE_CASE__ )
              hypotheses.append(hypothesis_template.format(SCREAMING_SNAKE_CASE__ ) )
      return premises, hypotheses
  
  
  def 						_A     (       SCREAMING_SNAKE_CASE__						:			Optional[Any] ):
      for label, ind in config.labelaid.items():
          if label.lower().startswith('''entail''' ):
              return ind
      logger.warning('''Could not identify entailment dimension from teacher config label2id. Setting to -1.''' )
      return -1
  
  
  def 						_A     (       SCREAMING_SNAKE_CASE__						:			str  ,						SCREAMING_SNAKE_CASE__						:			List[str]  ,						SCREAMING_SNAKE_CASE__						:			List[str]  ,						SCREAMING_SNAKE_CASE__						:			str  ,						SCREAMING_SNAKE_CASE__						:			int  ,						SCREAMING_SNAKE_CASE__						:			float  ,						SCREAMING_SNAKE_CASE__						:			bool  ,						SCREAMING_SNAKE_CASE__						:			bool  ,						SCREAMING_SNAKE_CASE__						:			bool  ,						SCREAMING_SNAKE_CASE__						:			bool  ,						):
      UpperCamelCase :Dict										=     AutoModelForSequenceClassification.from_pretrained(SCREAMING_SNAKE_CASE__ )
      UpperCamelCase :str										=     model.config
      if not no_cuda and torch.cuda.is_available():
          UpperCamelCase :Optional[int]										=     nn.DataParallel(model.cuda() )
          batch_size *= len(model.device_ids )
      UpperCamelCase :Union[str, Any]										=     AutoTokenizer.from_pretrained(SCREAMING_SNAKE_CASE__  ,						use_fast=SCREAMING_SNAKE_CASE__ )
  
      UpperCamelCase :str										=     get_premise_hypothesis_pairs(SCREAMING_SNAKE_CASE__  ,						SCREAMING_SNAKE_CASE__  ,						SCREAMING_SNAKE_CASE__ )
      UpperCamelCase :Any										=     []
  
      for i in tqdm(range(0  ,						len(SCREAMING_SNAKE_CASE__ )  ,						SCREAMING_SNAKE_CASE__ ) ):
          UpperCamelCase :List[str]										=     premises[i : i + batch_size]
          UpperCamelCase :Tuple										=     hypotheses[i : i + batch_size]
  
          UpperCamelCase :Union[str, Any]										=     tokenizer(
              SCREAMING_SNAKE_CASE__  ,						SCREAMING_SNAKE_CASE__  ,						padding=SCREAMING_SNAKE_CASE__  ,						truncation='''only_first'''  ,						return_tensors='''pt'''  ,						)
  
          with torch.cuda.amp.autocast(enabled=SCREAMING_SNAKE_CASE__ ):
              with torch.no_grad():
                  UpperCamelCase :int										=     model(**SCREAMING_SNAKE_CASE__ )
          logits.append(outputs.logits.detach().cpu().float() )
  
      UpperCamelCase :List[Any]										=     get_entailment_id(SCREAMING_SNAKE_CASE__ )
      UpperCamelCase :int										=     -1 if entail_id == 0 else 0
      UpperCamelCase :Any										=     torch.cat(SCREAMING_SNAKE_CASE__  ,						dim=0 )  # N*K x 3
      UpperCamelCase :Optional[int]										=     logits.reshape(len(SCREAMING_SNAKE_CASE__ )  ,						len(SCREAMING_SNAKE_CASE__ )  ,						-1 )[..., [contr_id, entail_id]]  # N x K x 2
  
      if multi_label:
          # softmax over (contr, entail) logits for each class independently
          UpperCamelCase :Optional[int]										=     (nli_logits / temperature).softmax(-1 )
      else:
          # softmax over entail logits across classes s.t. class probabilities sum to 1.
          UpperCamelCase :Dict										=     (nli_logits / temperature).softmax(1 )
  
      return nli_prob[..., 1]  # N x K
  
  
  def 						_A     (       ):
      UpperCamelCase :str										=     HfArgumentParser(
          (DataTrainingArguments, TeacherModelArguments, StudentModelArguments, DistillTrainingArguments)  ,						description=SCREAMING_SNAKE_CASE__  ,						)
  
      if len(sys.argv ) == 2 and sys.argv[1].endswith('''.json''' ):
          # If we pass only one argument to the script and it's the path to a json file,
          # let's parse it to get our arguments.
          UpperCamelCase :List[Any]										=     parser.parse_json_file(
              json_file=os.path.abspath(sys.argv[1] ) )
      else:
          UpperCamelCase :List[str]										=     parser.parse_args_into_dataclasses()
  
      # Detecting last checkpoint.
      UpperCamelCase :int										=     None
      if os.path.isdir(training_args.output_dir ) and training_args.do_train and not training_args.overwrite_output_dir:
          UpperCamelCase :str										=     get_last_checkpoint(training_args.output_dir )
          if last_checkpoint is None and len(os.listdir(training_args.output_dir ) ) > 0:
              raise ValueError(
                  F'''Output directory ({training_args.output_dir}) already exists and is not empty. '''
                  '''Use --overwrite_output_dir to overcome.''' )
          elif last_checkpoint is not None:
              logger.info(
                  F'''Checkpoint detected, resuming training at {last_checkpoint}. To avoid this behavior, change '''
                  '''the `--output_dir` or add `--overwrite_output_dir` to train from scratch.''' )
  
      # Setup logging
      logging.basicConfig(
          format='''%(asctime)s - %(levelname)s - %(name)s - %(message)s'''  ,						datefmt='''%m/%d/%Y %H:%M:%S'''  ,						handlers=[logging.StreamHandler(sys.stdout )]  ,						)
      logger.setLevel(logging.INFO if is_main_process(training_args.local_rank ) else logging.WARN )
  
      # Log on each process the small summary:
      logger.warning(
          F'''Process rank: {training_args.local_rank}, device: {training_args.device}, n_gpu: {training_args.n_gpu}'''
          + F'''distributed training: {bool(training_args.local_rank != -1 )}, 16-bits training: {training_args.fpaa}''' )
      # Set the verbosity to info of the Transformers logger (on main process only):
      if is_main_process(training_args.local_rank ):
          utils.logging.set_verbosity_info()
          utils.logging.enable_default_handler()
          utils.logging.enable_explicit_format()
  
      if training_args.local_rank != -1:
          raise ValueError('''Distributed training is not currently supported.''' )
      if training_args.tpu_num_cores is not None:
          raise ValueError('''TPU acceleration is not currently supported.''' )
  
      logger.info(F'''Training/evaluation parameters {training_args}''' )
  
      # Set seed before initializing model.
      set_seed(training_args.seed )
  
      # 1. read in data
      UpperCamelCase :str										=     read_lines(data_args.data_file )
      UpperCamelCase :int										=     read_lines(data_args.class_names_file )
  
      # 2. get teacher predictions and load into dataset
      logger.info('''Generating predictions from zero-shot teacher model''' )
      UpperCamelCase :List[Any]										=     get_teacher_predictions(
          teacher_args.teacher_name_or_path  ,						SCREAMING_SNAKE_CASE__  ,						SCREAMING_SNAKE_CASE__  ,						teacher_args.hypothesis_template  ,						teacher_args.teacher_batch_size  ,						teacher_args.temperature  ,						teacher_args.multi_label  ,						data_args.use_fast_tokenizer  ,						training_args.no_cuda  ,						training_args.fpaa  ,						)
      UpperCamelCase :str										=     Dataset.from_dict(
          {
              '''text''': examples,
              '''labels''': teacher_soft_preds,
          } )
  
      # 3. create student
      logger.info('''Initializing student model''' )
      UpperCamelCase :Union[str, Any]										=     AutoModelForSequenceClassification.from_pretrained(
          student_args.student_name_or_path  ,						num_labels=len(SCREAMING_SNAKE_CASE__ ) )
      UpperCamelCase :List[str]										=     AutoTokenizer.from_pretrained(student_args.student_name_or_path  ,						use_fast=data_args.use_fast_tokenizer )
      UpperCamelCase :Any										=     dict(enumerate(SCREAMING_SNAKE_CASE__ ) )
      UpperCamelCase :Any										=     {label: i for i, label in enumerate(SCREAMING_SNAKE_CASE__ )}
  
      # 4. train student on teacher predictions
      UpperCamelCase :Union[str, Any]										=     dataset.map(SCREAMING_SNAKE_CASE__  ,						input_columns='''text''' )
      dataset.set_format('''torch''' )
  
      def compute_metrics(SCREAMING_SNAKE_CASE__						:			Optional[int]  ,						SCREAMING_SNAKE_CASE__						:			Union[str, Any]=False ):
          UpperCamelCase :str										=     p.predictions.argmax(-1 )
          UpperCamelCase :int										=     p.label_ids.argmax(-1 )  # "label_ids" are actually distributions
          return {"agreement": (preds == proxy_labels).mean().item()}
  
      UpperCamelCase :List[str]										=     DistillationTrainer(
          model=SCREAMING_SNAKE_CASE__  ,						tokenizer=SCREAMING_SNAKE_CASE__  ,						args=SCREAMING_SNAKE_CASE__  ,						train_dataset=SCREAMING_SNAKE_CASE__  ,						compute_metrics=SCREAMING_SNAKE_CASE__  ,						)
  
      if training_args.do_train:
          logger.info('''Training student model on teacher predictions''' )
          trainer.train()
  
      if training_args.do_eval:
          UpperCamelCase :Dict										=     trainer.evaluate(eval_dataset=SCREAMING_SNAKE_CASE__ )['''eval_agreement''']
          logger.info(F'''Agreement of student and teacher predictions: {agreement * 100:0.2f}%''' )
  
      trainer.save_model()
  
  
  if __name__ == "__main__":
   main()
  
  
  
  
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()
  
  
  
  
  
  