code: def plot_ps_diagnostics(
      df, covariate_col, treatment_col="w", p_col="p", bal_tol=0.1
  ):
      """Plot covariate balances (standardized differences between the treatment and the control)
      before and after weighting the sample using the inverse probability of treatment weights.
  
       Args:
          df (pandas.DataFrame): a data frame containing the covariates and treatment indicator
          covariate_col (list of str): a list of columns that are used a covariates
          treatment_col (str, optional): the column name for the treatment indicator (0 or 1)
          p_col (str, optional): the column name for propensity score
      """
      X = df[covariate_col]
      W = df[treatment_col]
      PS = df[p_col]
  
      IPTW = get_simple_iptw(W, PS)
  
      diffs_pre = get_std_diffs(X, W, weighted=False)
      num_unbal_pre = (np.abs(diffs_pre) > bal_tol).sum()[0]
  
      diffs_post = get_std_diffs(X, W, IPTW, weighted=True)
      num_unbal_post = (np.abs(diffs_post) > bal_tol).sum()[0]
  
      diff_plot = _plot_std_diffs(
          diffs_pre,
          num_unbal_pre,
          diffs_post,
          num_unbal_post,
          bal_tol=bal_tol,
      )
  
      return diff_plot
  
imports: from matplotlib import pyplot
  import logging
  import numpy
  import pandas
  import seaborn
  from lightgbm import LGBMRegressor
  from ..inference.meta.tmle import TMLELearner
label_desc: Use image node_id 14 for calling a global function with example usage: plot_ps_diagnostics(df, covariate_col, treatment_col, p_col, bal_tol) and returns: diff_plot