code: def _main(trials: int):
      import matplotlib.pyplot as plt
      import numpy as np
      import pandas as pd
      import seaborn as sns
      from tabulate import tabulate
  
      from pykeen.constants import PYKEEN_EXPERIMENTS
      from pykeen.datasets import get_dataset
  
      n_comb = trials * (trials - 1) // 2
      logger.info(
          f"Number of combinations: {trials} n Choose 2 = {n_comb}"
      )
  
      ns = [0.01, 0.05, 0.1, 0.2, 0.3, 0.4]
      rows = []
      for dataset_name in [
          # 'kinships',
          "nations",
          # 'umls',
          # 'codexsmall',
          # 'wn18',
      ]:
          dataset_rows = []
          reference_dataset = get_dataset(dataset=dataset_name)
          for n in ns:
              similarities = []
              for trial in range(trials):
                  deteriorated_dataset = reference_dataset.deteriorate(
                      n=n, random_state=trial
                  )
                  sim = reference_dataset.similarity(
                      deteriorated_dataset
                  )
                  similarities.append(sim)
                  rows.append((dataset_name, n, trial, sim))
              dataset_rows.append(
                  (n, np.mean(similarities), np.std(similarities))
              )
          click.echo(
              tabulate(
                  dataset_rows,
                  headers=[f"{dataset_name} N", "Mean", "Std"],
              )
          )
  
      df = pd.DataFrame(rows, columns=["name", "n", "trial", "sim"])
      tsv_path = PYKEEN_EXPERIMENTS / "deteriorating.tsv"
      png_path = PYKEEN_EXPERIMENTS / "deteriorating.png"
      click.echo(f"writing to {tsv_path}")
      df.to_csv(tsv_path, sep="\t", index=False)
      sns.lineplot(data=df, x="n", y="sim", hue="name")
      plt.savefig(png_path, dpi=300)
  
file_path: pykeen/src/pykeen/triples/deteriorate.py
imports: import logging
  import math
  from itertools import zip_longest
  from typing import List, Union
  import click
  import more_click
  import torch
  from pykeen.triples import TriplesFactory
  from pykeen.typing import TorchRandomHint
  from pykeen.utils import ensure_torch_random_state
label_desc: Use image node_id 2 for calling a global function with example usage: _main(trials) without return types