original_docstring: 
      Plots for ranking of samples score-wise
      
docstring: Plots for ranking of samples score-wise
docstring_tokens: Plots for ranking of samples score - wise
code: def plot_relabeling_score(true_majority: np.ndarray,
                            starting_scores: np.ndarray,
                            current_majority: np.ndarray,
                            selector_name: str) -> None:
      """
      Plots for ranking of samples score-wise
      """
      create_folder(MAIN_SIMULATION_DIR / "scores_histogram")
      create_folder(MAIN_SIMULATION_DIR / "noise_detection_heatmaps")
  
      is_noisy = true_majority != current_majority
      total_noise_rate = np.mean(is_noisy)
  
      # Compute how many noisy sampled where present in the
      # highest n_noisy samples.
      target_perc = int((1 - total_noise_rate) * 100)
      q = np.percentile(starting_scores, q=target_perc)
      noisy_cases_detected = is_noisy[starting_scores > q]
      percentage_noisy_detected = 100 * float(noisy_cases_detected.sum()) / is_noisy.sum()
  
      # Plot histogram of scores differentiated by noisy or not.
      df = pd.DataFrame({"scores": starting_scores,
                         "is_noisy": is_noisy})
      plt.close()
      sns.histplot(data=df, x="scores", hue="is_noisy", multiple="dodge", bins=10)
      plt.title(f"Histogram of relabeling scores {selector_name}\n"
                f"{percentage_noisy_detected:.1f}% noise cases > {target_perc}th percentile of scores")
      plt.savefig(MAIN_SIMULATION_DIR / "scores_histogram" / selector_name)
      plt.close()
  
      # Plot heatmap showing where the noisy cases are located in the score ranking.
      idx = np.argsort(starting_scores)
      sorted_is_noisy = is_noisy[idx]
      plt.title(f"{selector_name}\n"
                f"Location of noisy cases by increasing scores (from left to right)\n"
                f"{percentage_noisy_detected:.1f}% noise cases > {target_perc}th percentile of scores")
      sns.heatmap(sorted_is_noisy.reshape(1, -1), yticklabels=False, vmax=1.3, cbar=False)
      plt.savefig(MAIN_SIMULATION_DIR / "noise_detection_heatmaps" / selector_name)
      plt.close()
code_tokens: def plot_relabeling_score ( true_majority : np . ndarray , starting_scores : np . ndarray , current_majority : np . ndarray , selector_name : str ) -> None : create_folder ( MAIN_SIMULATION_DIR / "scores_histogram" ) create_folder ( MAIN_SIMULATION_DIR / "noise_detection_heatmaps" ) is_noisy = true_majority != current_majority total_noise_rate = np . mean ( is_noisy ) target_perc = int ( ( 1 - total_noise_rate ) * 100 ) q = np . percentile ( starting_scores , q = target_perc ) noisy_cases_detected = is_noisy [ starting_scores > q ] percentage_noisy_detected = 100 * float ( noisy_cases_detected . sum ( ) ) / is_noisy . sum ( ) df = pd . DataFrame ( { "scores" : starting_scores , "is_noisy" : is_noisy } ) plt . close ( ) sns . histplot ( data = df , x = "scores" , hue = "is_noisy" , multiple = "dodge" , bins = 10 ) plt . title ( f"Histogram of relabeling scores {selector_name}\n" f"{percentage_noisy_detected:.1f}% noise cases > {target_perc}th percentile of scores" ) plt . savefig ( MAIN_SIMULATION_DIR / "scores_histogram" / selector_name ) plt . close ( ) idx = np . argsort ( starting_scores ) sorted_is_noisy = is_noisy [ idx ] plt . title ( f"{selector_name}\n" f"Location of noisy cases by increasing scores (from left to right)\n" f"{percentage_noisy_detected:.1f}% noise cases > {target_perc}th percentile of scores" ) sns . heatmap ( sorted_is_noisy . reshape ( 1 , - 1 ) , yticklabels = False , vmax = 1.3 , cbar = False ) plt . savefig ( MAIN_SIMULATION_DIR / "noise_detection_heatmaps" / selector_name ) plt . close ( )
short_docstring: Plots for ranking of samples score-wise
short_docstring_tokens: Plots for ranking of samples score - wise
comment: """
      Plots for ranking of samples score-wise
      """$SEP$# Compute how many noisy sampled where present in the$SEP$# highest n_noisy samples.$SEP$# Plot histogram of scores differentiated by noisy or not.$SEP$# Plot heatmap showing where the noisy cases are located in the score ranking.