code: def _f1_normalizer(df, y, model_score, random_seed):
      "In case of F1, calculates the baseline score for y and derives the PPS."
      label_encoder = preprocessing.LabelEncoder()
      df["truth"] = label_encoder.fit_transform(df[y])
      df["most_common_value"] = df["truth"].value_counts().index[0]
      random = df["truth"].sample(frac=1, random_state=random_seed)
  
      baseline_score = max(
          f1_score(
              df["truth"], df["most_common_value"], average="weighted"
          ),
          f1_score(df["truth"], random, average="weighted"),
      )
  
      ppscore = _normalized_f1_score(model_score, baseline_score)
      return ppscore, baseline_score
  
imports: import numpy
  from sklearn import tree
  from sklearn import preprocessing
  from sklearn.model_selection import cross_val_score
  from sklearn.metrics import mean_absolute_error, f1_score
  import pandas
  from pandas.api.types import is_numeric_dtype, is_bool_dtype, is_object_dtype, is_categorical_dtype, is_string_dtype, is_datetime64_any_dtype, is_timedelta64_dtype
label_desc: Use image node_id 5 for calling a global function with example usage: _f1_normalizer(df, y, model_score, random_seed) and returns: ppscore,  baseline_score