code: def matrix(df, output="df", sorted=False, **kwargs):
      """
      Calculate the Predictive Power Score (PPS) matrix for all columns in the dataframe.
  
      Args:
          df : pandas.DataFrame
              The dataframe that contains the data
          output: str - potential values: "df", "list"
              Control the type of the output. Either return a pandas.DataFrame (df) or a list with the score dicts
          sorted: bool
              Whether or not to sort the output dataframe/list by the ppscore
          kwargs:
              Other key-word arguments that shall be forwarded to the pps.score method,
              e.g. `sample, `cross_validation, `random_seed, `invalid_score`, `catch_errors`
  
      Returns:
          pandas.DataFrame or list of Dict
              Either returns a tidy dataframe or a list of all the PPS dicts. This can be influenced
              by the output argument
      """
      if not isinstance(df, pd.DataFrame):
          raise TypeError(
              f"The 'df' argument should be a pandas.DataFrame but you passed a {type(df)}\nPlease convert your input to a pandas.DataFrame"
          )
      if not output in ["df", "list"]:
          raise ValueError(
              f"""The 'output' argument should be one of ["df", "list"] but you passed: {output}\nPlease adjust your input to one of the valid values"""
          )
      if not sorted in [True, False]:
          raise ValueError(
              f"""The 'sorted' argument should be one of [True, False] but you passed: {sorted}\nPlease adjust your input to one of the valid values"""
          )
  
      scores = [score(df, x, y, **kwargs) for x in df for y in df]
  
      return _format_list_of_dicts(
          scores=scores, output=output, sorted=sorted
      )
  
imports: import warnings
  import numpy
  import pandas
  from pandas.api.types import is_bool_dtype, is_categorical_dtype, is_datetime64_any_dtype, is_numeric_dtype, is_object_dtype, is_string_dtype, is_timedelta64_dtype
  from sklearn import preprocessing, tree
  from sklearn.metrics import f1_score, mean_absolute_error
  from sklearn.model_selection import cross_val_score
  from deepchecks.utils.typing import Hashable
label_desc: Use image node_id 16 for calling a global function with example usage: matrix(df, output, sorted) and returns: _format_list_of_dicts