docstr: Show Partial Dependence Plot component
  
  Args:
      explainer (Explainer): explainer object constructed with either
                  ClassifierExplainer() or RegressionExplainer()
      title (str, optional): Title of tab or page. Defaults to
                  "Partial Dependence Plot".
      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_col (bool, optional): Hide feature selector. Defaults to False.
      hide_index (bool, optional): Hide index selector. Defaults to False.
      hide_title (bool, optional): Hide 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_selector (bool, optional): hide pos label selectors. Defaults to False.
      hide_popout (bool, optional): hide popout button
      hide_dropna (bool, optional): Hide drop na's toggle Defaults to False.
      hide_sample (bool, optional): Hide sample size input. Defaults to False.
      hide_gridlines (bool, optional): Hide gridlines input. Defaults to False.
      hide_gridpoints (bool, optional): Hide gridpounts input. Defaults to False.
      hide_cats_sort (bool, optional): Hide the categorical sorting dropdown. Defaults to False.
      index_dropdown (bool, optional): Use dropdown for index input instead
          of free text input. Defaults to True.
      feature_input_component (FeatureInputComponent): A FeatureInputComponent
          that will give the input to the graph instead of the index selector.
          If not None, hide_index=True. Defaults to None.
      pos_label ({int, str}, optional): initial pos label.
                  Defaults to explainer.pos_label
      col (str, optional): Feature to display PDP for. Defaults to None.
      index ({int, str}, optional): Index to add ice line to plot. Defaults to None.
      dropna (bool, optional): Drop rows where values equal explainer.na_fill (usually -999). Defaults to True.
      sample (int, optional): Sample size to calculate average partial dependence. Defaults to 100.
      gridlines (int, optional): Number of ice lines to display in plot. Defaults to 50.
      gridpoints (int, optional): Number of breakpoints on horizontal axis Defaults to 10.
      cats_sort (str, optional): how to sort categories: 'alphabet',
          'freq' or 'shap'. Defaults to 'freq'.
      description (str, optional): Tooltip to display when hover over
          component title. When None default text is shown.
docstr_tok: ["Show","Partial","Dependence","Plot","component","Args",":","explainer","(","Explainer",")",":","explainer","object","constructed","with","either","ClassifierExplainer","(",")","or","RegressionExplainer","(",")","title","(","str",",","optional",")",":","Title","of","tab","or","page",".","Defaults","to","``","Partial","Dependence","Plot","''",".","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_col","(","bool",",","optional",")",":","Hide","feature","selector",".","Defaults","to","False",".","hide_index","(","bool",",","optional",")",":","Hide","index","selector",".","Defaults","to","False",".","hide_title","(","bool",",","optional",")",":","Hide","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_selector","(","bool",",","optional",")",":","hide","pos","label","selectors",".","Defaults","to","False",".","hide_popout","(","bool",",","optional",")",":","hide","popout","button","hide_dropna","(","bool",",","optional",")",":","Hide","drop","na","'s","toggle","Defaults","to","False",".","hide_sample","(","bool",",","optional",")",":","Hide","sample","size","input",".","Defaults","to","False",".","hide_gridlines","(","bool",",","optional",")",":","Hide","gridlines","input",".","Defaults","to","False",".","hide_gridpoints","(","bool",",","optional",")",":","Hide","gridpounts","input",".","Defaults","to","False",".","hide_cats_sort","(","bool",",","optional",")",":","Hide","the","categorical","sorting","dropdown",".","Defaults","to","False",".","index_dropdown","(","bool",",","optional",")",":","Use","dropdown","for","index","input","instead","of","free","text","input",".","Defaults","to","True",".","feature_input_component","(","FeatureInputComponent",")",":","A","FeatureInputComponent","that","will","give","the","input","to","the","graph","instead","of","the","index","selector",".","If","not","None",",","hide_index=True",".","Defaults","to","None",".","pos_label","(","{","int",",","str","}",",","optional",")",":","initial","pos","label",".","Defaults","to","explainer.pos_label","col","(","str",",","optional",")",":","Feature","to","display","PDP","for",".","Defaults","to","None",".","index","(","{","int",",","str","}",",","optional",")",":","Index","to","add","ice","line","to","plot",".","Defaults","to","None",".","dropna","(","bool",",","optional",")",":","Drop","rows","where","values","equal","explainer.na_fill","(","usually","-999",")",".","Defaults","to","True",".","sample","(","int",",","optional",")",":","Sample","size","to","calculate","average","partial","dependence",".","Defaults","to","100.","gridlines","(","int",",","optional",")",":","Number","of","ice","lines","to","display","in","plot",".","Defaults","to","50.","gridpoints","(","int",",","optional",")",":","Number","of","breakpoints","on","horizontal","axis","Defaults","to","10.","cats_sort","(","str",",","optional",")",":","how","to","sort","categories",":","'alphabet","'",",","'freq","'","or","'shap","'",".","Defaults","to","'freq","'",".","description","(","str",",","optional",")",":","Tooltip","to","display","when","hover","over","component","title",".","When","None","default","text","is","shown","."]
code: def __init__(
      self,
      explainer,
      title="Partial Dependence Plot",
      name=None,
      subtitle="How does the prediction change if you change one feature?",
      hide_col=False,
      hide_index=False,
      hide_title=False,
      hide_subtitle=False,
      hide_footer=False,
      hide_selector=False,
      hide_popout=False,
      hide_dropna=False,
      hide_sample=False,
      hide_gridlines=False,
      hide_gridpoints=False,
      hide_cats_sort=False,
      index_dropdown=True,
      feature_input_component=None,
      pos_label=None,
      col=None,
      index=None,
      dropna=True,
      sample=100,
      gridlines=50,
      gridpoints=10,
      cats_sort="freq",
      description=None,
      **kwargs,
  ):
      """Show Partial Dependence Plot component
  
      Args:
          explainer (Explainer): explainer object constructed with either
                      ClassifierExplainer() or RegressionExplainer()
          title (str, optional): Title of tab or page. Defaults to
                      "Partial Dependence Plot".
          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_col (bool, optional): Hide feature selector. Defaults to False.
          hide_index (bool, optional): Hide index selector. Defaults to False.
          hide_title (bool, optional): Hide 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_selector (bool, optional): hide pos label selectors. Defaults to False.
          hide_popout (bool, optional): hide popout button
          hide_dropna (bool, optional): Hide drop na's toggle Defaults to False.
          hide_sample (bool, optional): Hide sample size input. Defaults to False.
          hide_gridlines (bool, optional): Hide gridlines input. Defaults to False.
          hide_gridpoints (bool, optional): Hide gridpounts input. Defaults to False.
          hide_cats_sort (bool, optional): Hide the categorical sorting dropdown. Defaults to False.
          index_dropdown (bool, optional): Use dropdown for index input instead
              of free text input. Defaults to True.
          feature_input_component (FeatureInputComponent): A FeatureInputComponent
              that will give the input to the graph instead of the index selector.
              If not None, hide_index=True. Defaults to None.
          pos_label ({int, str}, optional): initial pos label.
                      Defaults to explainer.pos_label
          col (str, optional): Feature to display PDP for. Defaults to None.
          index ({int, str}, optional): Index to add ice line to plot. Defaults to None.
          dropna (bool, optional): Drop rows where values equal explainer.na_fill (usually -999). Defaults to True.
          sample (int, optional): Sample size to calculate average partial dependence. Defaults to 100.
          gridlines (int, optional): Number of ice lines to display in plot. Defaults to 50.
          gridpoints (int, optional): Number of breakpoints on horizontal axis Defaults to 10.
          cats_sort (str, optional): how to sort categories: 'alphabet',
              'freq' or 'shap'. Defaults to 'freq'.
          description (str, optional): Tooltip to display when hover over
              component title. When None default text is shown.
      """
      super().__init__(explainer, title, name)
  
      self.index_name = "pdp-index-" + self.name
  
      if self.col is None:
          self.col = self.explainer.columns_ranked_by_shap()[0]
  
      if self.feature_input_component is not None:
          self.exclude_callbacks(self.feature_input_component)
          self.hide_index = True
  
      if self.description is None:
          self.description = f"""
          The partial dependence plot (pdp) show how the model prediction would
          change if you change one particular feature. The plot shows you a sample
          of observations and how these observations would change with this
          feature (gridlines). The average effect is shown in grey. The effect
          of changing the feature for a single {self.explainer.index_name} is
          shown in blue. You can adjust how many observations to sample for the 
          average, how many gridlines to show, and how many points along the
          x-axis to calculate model predictions for (gridpoints).
          """
      self.selector = PosLabelSelector(
          explainer, name=self.name, pos_label=pos_label
      )
      self.index_selector = IndexSelector(
          explainer,
          "pdp-index-" + self.name,
          index=index,
          index_dropdown=index_dropdown,
          **kwargs,
      )
  
      self.popout = GraphPopout(
          "pdp-" + self.name + "popout",
          "pdp-graph-" + self.name,
          self.title,
          self.description,
      )
  
imports: from math import ceil
  import numpy
  import pandas
  import dash
  from dash import html, dcc, Input, Output, State, dash_table
  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 PdpComponent object from inherited base classes: ExplainerComponent with example: obj = PdpComponent(explainer, title, name, subtitle, hide_col, hide_index, hide_title, hide_subtitle, hide_footer, hide_selector, hide_popout, hide_dropna, hide_sample, hide_gridlines, hide_gridpoints, hide_cats_sort, index_dropdown, feature_input_component, pos_label, col, index, dropna, sample, gridlines, gridpoints, cats_sort, description)