code: def main(force: bool, clip: int, mode):
      """Run the inverse stability experiments."""
      results_path = INVERSE_STABILITY / "results.tsv"
      if results_path.exists() and not force:
          df = pd.read_csv(results_path, sep="\t")
          df["residuals"] = df["forward"] - df["inverse"]
          df = df[(-clip < df["residuals"]) & (df["residuals"] < clip)]
          g = sns.FacetGrid(
              df,
              col="model",
              row="dataset",
              hue="training_loop",
              sharex=False,
              sharey=False,
          )
          g.map_dataframe(sns.histplot, x="residuals", stat="density")
          g.add_legend()
          g.savefig(
              INVERSE_STABILITY / "results_residuals.png", dpi=300
          )
  
      else:
          outer_dfs = []
          datasets = ["nations", "kinships"]
          models = ["rotate", "complex", "simple", "transe", "distmult"]
          training_loops = ["lcwa", "slcwa"]
          for dataset, model, training_loop in itt.product(
              datasets, models, training_loops
          ):
              click.secho(
                  f"{dataset} {model} {training_loop}", fg="cyan"
              )
              df = run_inverse_stability_workflow(
                  dataset=dataset,
                  model=model,
                  training_loop=training_loop,
                  mode=mode,
              )
              outer_dfs.append(df)
          outer_df = pd.concat(outer_dfs)
          outer_df.to_csv(
              INVERSE_STABILITY / "results.tsv", sep="\t", index=False
          )
  
file_path: pykeen/src/pykeen/experiments/inverse_stability.py
imports: import itertools
  import logging
  from typing import Optional, Type
  import click
  import matplotlib.pyplot
  import pandas
  import seaborn
  import pykeen.evaluation.evaluator
  from pykeen.constants import PYKEEN_EXPERIMENTS
  from pykeen.datasets import Dataset, get_dataset
  from pykeen.models import Model, model_resolver
  from pykeen.pipeline import pipeline
  from pykeen.typing import InductiveMode
label_desc: Use image node_id 1 for calling a global function with example usage: main(force, clip, mode) without return types