code: def confidence_filtering_3d_plot(
      thresholds_1,
      thresholds_2,
      accuracies,
      dataset_kepts,
      threshold_output_feature_names=None,
      title=None,
      filename=None,
      callbacks=None,
  ):
      assert len(accuracies) == len(dataset_kepts)
      assert len(thresholds_1) == len(thresholds_2)
  
      thresholds_1, thresholds_2 = np.meshgrid(
          thresholds_1, thresholds_2
      )
  
      colors = plt.get_cmap("tab10").colors
      sns.set_style("white")
  
      z_ticks_minor = np.linspace(0.0, 1.0, num=21)
      z_ticks_major = np.linspace(0.0, 1.0, num=11)
      z_ticks_major_labels = [f"{z * 100:3.0f}%" for z in z_ticks_major]
  
      fig = plt.figure()
      ax = Axes3D
      ax = fig.add_subplot(111, projection="3d")
  
      if title is not None:
          ax.set_title(title)
  
      ax.grid(which="both")
      ax.grid(which="minor", alpha=0.5)
      ax.grid(which="major", alpha=0.75)
  
      ax.set_xlabel(f"{threshold_output_feature_names[0]} probability")
      ax.set_ylabel(f"{threshold_output_feature_names[1]} probability")
  
      ax.set_xlim(np.min(thresholds_1), np.max(thresholds_1))
      ax.set_ylim(np.min(thresholds_2), np.max(thresholds_2))
      ax.set_zlim(0, 1)
      ax.set_zticks(z_ticks_major)
      ax.set_zticklabels(z_ticks_major_labels)
      ax.set_zticks(z_ticks_minor, minor=True)
  
      # ORRIBLE HACK, IT'S THE ONLY WAY TO REMOVE PADDING
      from mpl_toolkits.mplot3d.axis3d import Axis
  
      if not hasattr(Axis, "_get_coord_info_old"):
  
          def _get_coord_info_new(self, renderer):
              (
                  mins,
                  maxs,
                  centers,
                  deltas,
                  tc,
                  highs,
              ) = self._get_coord_info_old(renderer)
              mins += deltas / 4
              maxs -= deltas / 4
              return mins, maxs, centers, deltas, tc, highs
  
          Axis._get_coord_info_old = Axis._get_coord_info
          Axis._get_coord_info = _get_coord_info_new
      # END OF HORRIBLE HACK
  
      surf_1 = ax.plot_surface(
          thresholds_1,
          thresholds_2,
          accuracies,
          alpha=0.5,
          label="accuracy",
          cmap=plt.get_cmap("winter"),
          edgecolor="none",
      )
      surf_2 = ax.plot_surface(
          thresholds_1,
          thresholds_2,
          dataset_kepts,
          alpha=0.5,
          label="data coverage",
          cmap=plt.get_cmap("autumn"),
          edgecolor="none",
      )
  
      handle_1 = copy.copy(surf_1)
      handle_2 = copy.copy(surf_2)
  
      handle_1.set_color(colors[0])
      handle_2.set_color(colors[1])
  
      # ## the next block is needed because matplotlib 3.3.3 renamed
      # _edgecolors3d -> _edgecolor3d
      # _facecolors3d -> _facecolor3d
      # but we want to try to keep compatibility with older versions
      # #### BEGIN COMPATIBILITY BLOCK #####
      if hasattr(handle_1, "_edgecolors3d"):
          edgecolor3d = handle_1._edgecolors3d
      else:
          edgecolor3d = handle_1._edgecolor3d
      handle_1._edgecolors2d = edgecolor3d
      handle_1._edgecolor2d = edgecolor3d
  
      if hasattr(handle_2, "_edgecolors3d"):
          edgecolor3d = handle_2._edgecolors3d
      else:
          edgecolor3d = handle_2._edgecolor3d
      handle_2._edgecolors2d = edgecolor3d
      handle_2._edgecolor2d = edgecolor3d
  
      if hasattr(handle_1, "_facecolors3d"):
          facecolor3d = handle_1._facecolors3d
      else:
          facecolor3d = handle_1._facecolor3d
      handle_1._facecolors2d = facecolor3d
      handle_1._facecolor2d = facecolor3d
  
      if hasattr(handle_2, "_facecolors3d"):
          facecolor3d = handle_2._facecolors3d
      else:
          facecolor3d = handle_2._facecolor3d
      handle_2._facecolors2d = facecolor3d
      handle_2._facecolor2d = facecolor3d
      # #### END COMPATIBILITY BLOCK #####
  
      ax.legend(frameon=True, loc=3, handles=[handle_1, handle_2])
  
      plt.tight_layout()
      visualize_callbacks(callbacks, plt.gcf())
      if filename:
          plt.savefig(filename)
      else:
          plt.show()
  
imports: import copy
  import logging
  from collections import Counter
  from sys import platform
  from typing import Dict, List
  import numpy
  import pandas
  import ptitprince
  from packaging import version
  from ludwig.constants import SPACE, TRAINING, VALIDATION
label_desc: Use image node_id 12 for calling a global function with example usage: confidence_filtering_3d_plot(thresholds_1, thresholds_2, accuracies, dataset_kepts, threshold_output_feature_names, title, filename, callbacks) and returns: mins,  maxs,  centers,  deltas,  tc,  highs