code: def get_feature_label_correlation_per_class(
      train_df: pd.DataFrame,
      train_label_name: Optional[Hashable],
      test_df: pd.DataFrame,
      test_label_name: Optional[Hashable],
      ppscore_params: dict,
      n_show_top: int,
      min_pps_to_show: float = 0.05,
      random_state: int = None,
      with_display: bool = True,
      dataset_names: Tuple[str] = DEFAULT_DATASET_NAMES,
  ):
      """
      Calculate the PPS for train, test and difference for feature label correlation checks per class.
  
      The PPS represents the ability of a feature to single-handedly predict another feature or label.
      This function calculates the PPS per feature for both train and test, and returns the data and display graph.
  
      Uses the ppscore package - for more info, see https://github.com/8080labs/ppscore
  
      Args:
          train_df: pd.DataFrame
              DataFrame of all train features and label
          train_label_name:: str
              name of label column in train dataframe
          test_df:
              DataFrame of all test features and label
          test_label_name: str
              name of label column in test dataframe
          ppscore_params: dict
              dictionary of additional parameters for the ppscore predictor function
          n_show_top: int
              Number of features to show, sorted by the magnitude of difference in PPS
          min_pps_to_show: float, default 0.05
              Minimum PPS to show a class in the graph
          random_state: int, default None
              Random state for the ppscore.predictors function
          dataset_names: tuple, default: DEFAULT_DATASET_NAMES
              The names to show in the display for the first and second datasets.
  
      Returns:
          CheckResult
              value: dictionaries of features, each value is 3 dictionaries of PPS values for train, test and
              train-test difference.
              display: bar graphs of the PPS for each feature.
      """
      df_pps_train_all = pd.DataFrame()
      df_pps_test_all = pd.DataFrame()
      df_pps_difference_all = pd.DataFrame()
      display = []
      ret_value = {}
  
      for c in train_df[train_label_name].unique():
          train_df_all_vs_one = train_df.copy()
          test_df_all_vs_one = test_df.copy()
  
          train_df_all_vs_one[train_label_name] = train_df_all_vs_one[
              train_label_name
          ].apply(
              lambda x: 1 if x == c else 0
          )  # pylint: disable=cell-var-from-loop
          test_df_all_vs_one[test_label_name] = test_df_all_vs_one[
              test_label_name
          ].apply(
              lambda x: 1 if x == c else 0
          )  # pylint: disable=cell-var-from-loop
  
          df_pps_train = pps.predictors(
              df=train_df_all_vs_one,
              y=train_label_name,
              random_seed=random_state,
              **ppscore_params,
          )
          df_pps_test = pps.predictors(
              df=test_df_all_vs_one,
              y=test_label_name,
              random_seed=random_state,
              **ppscore_params,
          )
  
          s_pps_train = df_pps_train.set_index("x", drop=True)[
              "ppscore"
          ]
          s_pps_test = df_pps_test.set_index("x", drop=True)["ppscore"]
          s_difference = s_pps_train - s_pps_test
  
          df_pps_train_all[c] = s_pps_train
          df_pps_test_all[c] = s_pps_test
          df_pps_difference_all[c] = s_difference
  
      for feature in df_pps_train_all.index:
          s_train = df_pps_train_all.loc[feature]
          s_test = df_pps_test_all.loc[feature]
          s_difference = df_pps_difference_all.loc[feature]
  
          ret_value[feature] = {
              "train": s_train.to_dict(),
              "test": s_test.to_dict(),
              "train-test difference": s_difference.to_dict(),
          }
  
          # display only if not all scores are above min_pps_to_show
          if (
              with_display
              and any(s_train > min_pps_to_show)
              or any(s_test > min_pps_to_show)
          ):
              sorted_order_for_display = (
                  np.abs(s_difference)
                  .sort_values(ascending=False)
                  .head(n_show_top)
                  .index
              )
  
              s_train_to_display = s_train[sorted_order_for_display]
              s_test_to_display = s_test[sorted_order_for_display]
  
              fig = get_pps_figure(
                  per_class=True,
                  n_of_features=len(sorted_order_for_display),
              )
              fig.update_layout(
                  title=f"{feature}: Predictive Power Score (PPS) Per Class"
              )
              fig.add_trace(
                  pd_series_to_trace(
                      s_train_to_display,
                      DEFAULT_DATASET_NAMES[0],
                      dataset_names[0],
                  )
              )
              fig.add_trace(
                  pd_series_to_trace(
                      s_test_to_display,
                      DEFAULT_DATASET_NAMES[1],
                      dataset_names[1],
                  )
              )
              display.append(fig)
  
      return ret_value, display
  
file_path: deepchecks/deepchecks/core/check_utils/feature_label_correlation_utils.py
imports: from typing import Optional, Tuple
  import numpy
  import pandas
  import plotly.graph_objects
  import deepchecks.ppscore
  from deepchecks.utils.plot import DEFAULT_DATASET_NAMES, colors
  from deepchecks.utils.strings import format_percent
  from deepchecks.utils.typing import Hashable
label_desc: Use image node_id 5 for calling a global function with example usage: get_feature_label_correlation_per_class(train_df, train_label_name, test_df, test_label_name, ppscore_params, n_show_top, min_pps_to_show, random_state, with_display, dataset_names) and returns: ret_value,  display