code: def load_and_run_clustering_experiment(
      problem_path,
      results_path,
      dataset,
      clusterer,
      resample_id=0,
      cls_name=None,
      overwrite=False,
      format=".ts",
      train_file=False,
  ):
      """Run a clustering experiment.
  
      Method to run a basic experiment and write the results to files called
      testFold<resampleID>.csv and, if required, trainFold<resampleID>.csv. This
      version loads the data from file based on a path. The
      clusterer is always trained on the
  
      Parameters
      ----------
      problem_path : str
          Location of problem files, full path.
      results_path : str
          Location of where to write results. Any required directories will be created
      dataset : str
          Name of problem. Files must be  <problem_path>/<dataset>/<dataset>+
          "_TRAIN"+format, same for "_TEST"
      clusterer : the clusterer
      cls_name : str, default =None
          determines what to call the write directory. If None, it is set to
          type(clusterer).__name__
      resample_id : int, default = 0
          Seed for resampling. If set to 0, the default train/test split from file is
          used. Also used in output file name.
      overwrite : boolean, default = False
          if False, this will only build results if there is not a result file already
          present. If True, it will overwrite anything already there.
      format: string, default = ".ts"
          Valid formats are ".ts", ".arff", ".tsv" and ".long". For more info on
          format, see   examples/loading_data.ipynb
      train_file: boolean, default = False
          whether to generate train files or not. If true, it performs a 10xCV on the
          train and saves
      """
      if cls_name is None:
          cls_name = type(clusterer).__name__
  
      # Set up the file path in standard format
      if not overwrite:
          full_path = (
              str(results_path)
              + "/"
              + str(cls_name)
              + "/Predictions/"
              + str(dataset)
              + "/testResample"
              + str(resample_id)
              + ".csv"
          )
          if os.path.exists(full_path):
              build_test = False
          if train_file:
              full_path = (
                  str(results_path)
                  + "/"
                  + str(cls_name)
                  + "/Predictions/"
                  + str(dataset)
                  + "/trainResample"
                  + str(resample_id)
                  + ".csv"
              )
              if os.path.exists(full_path):
                  train_file = False
          if train_file is False and build_test is False:
              return
  
      # currently only works with .ts
      trainX, trainY = load_ts(
          problem_path + dataset + "/" + dataset + "_TRAIN" + format
      )
      testX, testY = load_ts(
          problem_path + dataset + "/" + dataset + "_TEST" + format
      )
      if resample_id != 0:
          trainX, trainY, testX, testY = stratified_resample(
              trainX, trainY, testX, testY, resample_id
          )
      run_clustering_experiment(
          trainX,
          clusterer,
          trainY=trainY,
          testX=testX,
          testY=testY,
          cls_name=cls_name,
          dataset_name=dataset,
          results_path=results_path,
      )
  
file_path: sktime/sktime/benchmarking/experiments.py
imports: import os
  import time
  from datetime import datetime
  import numpy
  from sklearn import preprocessing
  from sklearn.metrics import accuracy_score
  from sklearn.model_selection import cross_val_predict
  from sktime.datasets import load_from_tsfile_to_dataframe
  from sktime.datasets import write_results_to_uea_format
  from sktime.utils.sampling import stratified_resample
label_desc: Use image node_id 2 for calling a global function with example usage: load_and_run_clustering_experiment(problem_path, results_path, dataset, clusterer, resample_id, cls_name, overwrite, format, train_file) without return types