code: def plot_logistic_regression_loss_benchmark(result_dir=None):
      df, result_dir = _load_benchmark_data(result_dir)
  
      fig, axes = plt.subplots(1, 2)
      ax_time = axes[0]
      ax_speedup = axes[1]
  
      max_threads = df["n_threads"].max()
      ax_speedup.plot(
          [1, max_threads],
          [1, max_threads],
          linestyle="--",
          lw=1,
          color="grey",
      )
      for build, df_build in df.groupby("build"):
          group_by_threads = df_build.groupby("n_threads")
          grouped_times = group_by_threads["time"]
  
          mean_times = grouped_times.mean()
          confidence_times = grouped_times.std() / np.sqrt(
              grouped_times.count()
          )
          confidence_times *= 1.96
  
          ax_time.plot(mean_times, label=build)
          ax_time.set_title("Time needed")
  
          ax_time.fill_between(
              mean_times.index,
              mean_times - confidence_times,
              mean_times + confidence_times,
              alpha=0.3,
          )
  
          speed_ups = mean_times[1] / mean_times
          ax_speedup.plot(speed_ups, label=build)
          ax_speedup.set_title("Speed up")
  
          for ax in axes:
              ax.legend()
              ax.set_xlabel("Threads")
  
      plot_file_path = os.path.abspath(
          os.path.join(result_dir, "result.png")
      )
      plt.savefig(plot_file_path)
      print("saved figure in {}".format(plot_file_path))
  
imports: import os
  import matplotlib.pyplot
  import numpy
  import pandas
  from tools.benchmark.benchmark_util import iter_executables, run_benchmark, extract_build_from_name, default_result_dir, get_last_result_dir
label_desc: Use image node_id 3 for calling a global function with example usage: plot_logistic_regression_loss_benchmark(result_dir) without return types