class_docstr: SmartPlotter is a Bridge pattern decoupling plotting functions from SmartExplainer.
  The smartplotter class includes all the methods used to display graphics
  Each SmartPlotter method is easy to use from a Smart explainer object,
  just use the following syntax
  Attributes :
  explainer: object
      SmartExplainer instance to point to.
  Example
  --------
  >>> xpl.plot.my_plot_method(param=value)
class_docstr_tok: ["SmartPlotter","is","a","Bridge","pattern","decoupling","plotting","functions","from","SmartExplainer",".","The","smartplotter","class","includes","all","the","methods","used","to","display","graphics","Each","SmartPlotter","method","is","easy","to","use","from","a","Smart","explainer","object",",","just","use","the","following","syntax","Attributes",":","explainer",":","object","SmartExplainer","instance","to","point","to",".","Example","--","--","--","--",">",">",">","xpl.plot.my_plot_method","(","param=value",")"]
docstr: _prediction_classification_plot displays a Plotly violin plot of predictions in comparison to the target variable.
  This plot represents Trues Values versus Predicted Values.
  
  This plot allows the user to understand the distribution of predictions in comparison to the target variable.
  With the web app, it is possible to select the wrong or correct predictions or a subset of predictions.
  
  Parameters
  ----------
  label: integer or string (default -1)
      If the label is of string type, check if it can be changed to integer to select the
      good dataframe object.
  list_ind: list
      Contains list of index that we want to plot
code: def _prediction_classification_plot(
      self,
      list_ind,
      label=-1,
  ):
      """
      _prediction_classification_plot displays a Plotly violin plot of predictions in comparison to the target variable.
      This plot represents Trues Values versus Predicted Values.
  
      This plot allows the user to understand the distribution of predictions in comparison to the target variable.
      With the web app, it is possible to select the wrong or correct predictions or a subset of predictions.
  
      Parameters
      ----------
      label: integer or string (default -1)
          If the label is of string type, check if it can be changed to integer to select the
          good dataframe object.
      list_ind: list
          Contains list of index that we want to plot
      """
      fig = go.Figure()
  
      label_num, _, label_value = self.explainer.check_label_name(label)
      # predict proba Color scale
      if hasattr(self.explainer.model, "predict_proba"):
          if not hasattr(self.explainer, "proba_values"):
              self.explainer.predict_proba()
          if hasattr(self.explainer.model, "predict"):
              if (
                  not hasattr(self.explainer, "y_pred")
                  or self.explainer.y_pred is None
              ):
                  self.explainer.predict()
          # Assign proba values of the target
          df_proba_target = self.explainer.proba_values.copy()
          df_proba_target["proba_target"] = df_proba_target.iloc[
              :, label_num
          ]
          proba_values = df_proba_target[["proba_target"]]
          # Proba subset:
          proba_values = proba_values.loc[list_ind, :]
          target = self.explainer.y_target.loc[list_ind, :]
          y_pred = self.explainer.y_pred.loc[list_ind, :]
          df_pred = pd.concat(
              [
                  proba_values.reset_index(),
                  y_pred.reset_index(drop=True),
                  target.reset_index(drop=True),
              ],
              axis=1,
          )
          df_pred.set_index(df_pred.columns[0], inplace=True)
          df_pred.columns = ["proba_values", "predict_class", "target"]
          df_pred["wrong_predict"] = 1
          df_pred.loc[
              (df_pred["predict_class"] == df_pred["target"]),
              "wrong_predict",
          ] = 0
          subtitle = f"Response: <b>{label_value}</b>"
  
      # Plot distribution
      fig.add_trace(
          go.Violin(
              x=df_pred["target"].values.flatten(),
              y=df_pred["proba_values"].values.flatten(),
              points=False,
              legendgroup="M",
              scalegroup="M",
              name="Correct Prediction",
              line_color=self._style_dict["violin_area_classif"][1],
              pointpos=-0.1,
              showlegend=False,
              jitter=0.075,
              meanline_visible=True,
              spanmode="hard",
              customdata=df_pred["proba_values"].index.values,
              scalemode="count",
          )
      )
  
      # Plot points depending if wrong or correct prediction
      df_correct_predict = df_pred[(df_pred["wrong_predict"] == 0)]
      df_wrong_predict = df_pred[(df_pred["wrong_predict"] == 1)]
      hv_text_correct_predict = [
          f"Id: {x}<br />Predicted Values: {y:.3f}<br />Predicted class: {w}<br />True Values: {z}<br />"
          for x, y, w, z in zip(
              df_correct_predict.index,
              df_correct_predict.proba_values.values.round(3).flatten(),
              df_correct_predict.predict_class.values.flatten(),
              df_correct_predict.target.values.flatten(),
          )
      ]
      hv_text_wrong_predict = [
          f"Id: {x}<br />Predicted Values: {y:.3f}<br />Predicted class: {w}<br />True Values: {z}<br />"
          for x, y, w, z in zip(
              df_wrong_predict.index,
              df_wrong_predict.proba_values.values.round(3).flatten(),
              df_wrong_predict.predict_class.values.flatten(),
              df_wrong_predict.target.values.flatten(),
          )
      ]
  
      fig.add_trace(
          go.Scatter(
              x=df_correct_predict["target"].values.flatten()
              + np.random.normal(0, 0.02, len(df_correct_predict)),
              y=df_correct_predict["proba_values"].values.flatten(),
              mode="markers",
              marker_color=self._style_dict["prediction_plot"][0],
              showlegend=True,
              name="Correct Prediction",
              hovertext=hv_text_correct_predict,
              hovertemplate="<b>%{hovertext}</b><br />",
              customdata=df_correct_predict[
                  "proba_values"
              ].index.values,
          )
      )
  
      fig.add_trace(
          go.Scatter(
              x=df_wrong_predict["target"].values.flatten()
              + np.random.normal(0, 0.02, len(df_wrong_predict)),
              y=df_wrong_predict["proba_values"].values.flatten(),
              mode="markers",
              marker_color=self._style_dict["prediction_plot"][1],
              showlegend=True,
              name="Wrong Prediction",
              hovertext=hv_text_wrong_predict,
              hovertemplate="<b>%{hovertext}</b><br />",
              customdata=df_wrong_predict["proba_values"].index.values,
          )
      )
  
      fig.update_layout(violingap=0, violinmode="overlay")
      if self.explainer.label_dict is not None:
          fig.update_xaxes(
              tickmode="array",
              tickvals=list(df_pred["target"].unique()),
              ticktext=list(
                  df_pred["target"]
                  .apply(lambda x: self.explainer.label_dict[x])
                  .unique()
              ),
          )
      if self.explainer.label_dict is None:
          fig.update_xaxes(
              tickvals=sorted(list(df_pred["target"].unique()))
          )
  
      return fig, subtitle
  
imports: import warnings
  from numbers import Number
  import random
  import copy
  import math
  import numpy
  from scipy.optimize import fsolve
  import scipy.cluster.hierarchy
  import pandas
  from plotly import graph_objs
  import plotly.express
  from plotly.subplots import make_subplots
  from plotly.offline import plot
  from shapash.manipulation.select_lines import select_lines
  from shapash.manipulation.summarize import compute_features_import, project_feature_values_1d, compute_corr
  from shapash.utils.utils import add_line_break, truncate_str, compute_digit_number, add_text, maximum_difference_sort_value, compute_sorted_variables_interactions_list_indices, compute_top_correlations_features
  from shapash.webapp.utils.utils import round_to_k
  from shapash.style.style_utils import colors_loading, select_palette, define_style
label_desc: Use image node_id 33 for calling the SmartPlotter obj's underlying member method code with example usage: obj._prediction_classification_plot(list_ind, label) and returns: fig,  subtitle