docstr: Residuals plot component
  
  Args:
      explainer (Explainer): explainer object constructed with either
                  ClassifierExplainer() or RegressionExplainer()
      title (str, optional): Title of tab or page. Defaults to
                  "Residuals".
      name (str, optional): unique name to add to Component elements.
                  If None then random uuid is generated to make sure
                  it's unique. Defaults to None.
      subtitle (str): subtitle
      hide_title (bool, optional) Hide the title. Defaults to False.
      hide_subtitle (bool, optional): Hide subtitle. Defaults to False.
      hide_footer (bool, optional): hide the footer at the bottom of the component
      hide_pred_or_actual (bool, optional): hide vs predictions or vs
                  actual for x-axis toggle. Defaults to False.
      hide_ratio (bool, optional): hide residual type dropdown. Defaults to False.
      hide_popout (bool, optional): hide popout button. Defaults to False.
      pred_or_actual (str, {'vs_actual', 'vs_pred'}, optional): Whether
                  to plot actual or predictions on the x-axis.
                  Defaults to "vs_pred".
      residuals (str, {'difference', 'ratio', 'log-ratio'} optional):
              How to calcualte residuals. Defaults to 'difference'.
      round (int, optional): rounding to apply to float predictions.
          Defaults to 3.
      plot_sample (int, optional): Instead of all points only plot a random
          sample of points. Defaults to None (=all points)
      description (str, optional): Tooltip to display when hover over
          component title. When None default text is shown.
code: def __init__(
      self,
      explainer,
      title="Residuals",
      name=None,
      subtitle="How much is the model off?",
      hide_title=False,
      hide_subtitle=False,
      hide_footer=False,
      hide_pred_or_actual=False,
      hide_ratio=False,
      hide_popout=False,
      pred_or_actual="vs_pred",
      residuals="difference",
      round=3,
      plot_sample=None,
      description=None,
      **kwargs,
  ):
      """Residuals plot component
  
      Args:
          explainer (Explainer): explainer object constructed with either
                      ClassifierExplainer() or RegressionExplainer()
          title (str, optional): Title of tab or page. Defaults to
                      "Residuals".
          name (str, optional): unique name to add to Component elements.
                      If None then random uuid is generated to make sure
                      it's unique. Defaults to None.
          subtitle (str): subtitle
          hide_title (bool, optional) Hide the title. Defaults to False.
          hide_subtitle (bool, optional): Hide subtitle. Defaults to False.
          hide_footer (bool, optional): hide the footer at the bottom of the component
          hide_pred_or_actual (bool, optional): hide vs predictions or vs
                      actual for x-axis toggle. Defaults to False.
          hide_ratio (bool, optional): hide residual type dropdown. Defaults to False.
          hide_popout (bool, optional): hide popout button. Defaults to False.
          pred_or_actual (str, {'vs_actual', 'vs_pred'}, optional): Whether
                      to plot actual or predictions on the x-axis.
                      Defaults to "vs_pred".
          residuals (str, {'difference', 'ratio', 'log-ratio'} optional):
                  How to calcualte residuals. Defaults to 'difference'.
          round (int, optional): rounding to apply to float predictions.
              Defaults to 3.
          plot_sample (int, optional): Instead of all points only plot a random
              sample of points. Defaults to None (=all points)
          description (str, optional): Tooltip to display when hover over
              component title. When None default text is shown.
      """
      super().__init__(explainer, title, name)
  
      assert residuals in ["difference", "ratio", "log-ratio"], (
          "parameter residuals should in ['difference', 'ratio', 'log-ratio']"
          f" but you passed residuals={residuals}"
      )
  
      if self.description is None:
          self.description = f"""
          The residuals are the difference between the observed {self.explainer.target}
          and predicted {self.explainer.target}. In this plot you can check if 
          the residuals are higher or lower for higher/lower actual/predicted outcomes. 
          So you can check if the model works better or worse for different {self.explainer.target}
          levels.
          """
  
      self.popout = GraphPopout(
          "residuals-" + self.name + "popout",
          "residuals-graph-" + self.name,
          self.title,
          self.description,
      )
      self.register_dependencies(["preds", "residuals"])
  
imports: import numpy
  import pandas
  import dash
  from dash import html, dcc, Input, Output, State
  from dash.exceptions import PreventUpdate
  import dash_bootstrap_components
  from ..dashboard_methods import *
  from ..None import to_html
label_desc: Use image node_id 1 to create a new ResidualsComponent object from inherited base classes: ExplainerComponent with example: obj = ResidualsComponent(explainer, title, name, subtitle, hide_title, hide_subtitle, hide_footer, hide_pred_or_actual, hide_ratio, hide_popout, pred_or_actual, residuals, round, plot_sample, description)