code: def plot_pr(self):
      colors = cycle(
          [
              "#636EFA",
              "#EF553B",
              "#00CC96",
              "#AB63FA",
              "#FFA15A",
              "#19D3F3",
              "#FF6692",
              "#B6E880",
              "#FF97FF",
              "#FECB52",
          ]
      )
  
      # Binarize the output
      y_test = label_binarize(
          self.y_test, classes=list(set(self.y_test.flatten()))
      )
      n_classes = y_test.shape[1]
  
      # Compute Precision-Recall and plot curve
      precision = dict()
      recall = dict()
      average_precision = dict()
  
      for i in range(n_classes):
          precision[i], recall[i], _ = precision_recall_curve(
              y_test[:, i], self.y_pred[:, i]
          )
          average_precision[i] = average_precision_score(
              y_test[:, i], self.y_pred[:, i]
          )
  
      # Compute micro-average ROC curve and ROC area
      precision["micro"], recall["micro"], _ = precision_recall_curve(
          y_test.ravel(), self.y_pred.ravel()
      )
      average_precision["micro"] = average_precision_score(
          y_test, self.y_pred, average="micro"
      )
  
      data = []
      trace2 = go.Scatter(
          x=recall["micro"],
          y=precision["micro"],
          mode="lines",
          line=dict(color="gold", width=2),
          name="micro-average Precision-recall curve (area = {0:0.2f})"
          "".format(average_precision["micro"]),
      )
      data.append(trace2)
  
      for i, color in zip(range(n_classes), colors):
          trace3 = go.Scatter(
              x=recall[i],
              y=precision[i],
              mode="lines",
              line=dict(color=color, width=2),
              name="Precision-recall curve of class {0} (area = {1:0.2f})"
              "".format(i, average_precision[i]),
          )
          data.append(trace3)
  
      layout = go.Layout(
          title="Precision-Recall curve",
          xaxis=dict(title="Recall"),
          yaxis=dict(title="Precision"),
          margin=dict(pad=25),
      )
  
      fig = go.Figure(data=data, layout=layout)
  
      return fig
  
imports: import pandas
  import numpy
  import sklearn
  from sklearn import *
  from sklearn.ensemble import RandomForestClassifier
  from sklearn.model_selection import train_test_split
  from sklearn.preprocessing import label_binarize
  from sklearn.metrics import *
  from itertools import cycle
  import colorlover
  import plotly.figure_factory
  import plotly.graph_objects
label_desc: Use image node_id 5 for calling the performance_metrics obj's underlying member method code with example usage: obj.plot_pr() and returns: fig