docstr: Display features importances component
  
  Args:
      explainer (Explainer): explainer object constructed with either
                  ClassifierExplainer() or RegressionExplainer()
      title (str, optional): Title of tab or page. Defaults to
                  "Feature Importances".
      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, optional): Subtitle.
      hide_type (bool, optional): Hide permutation/shap selector toggle.
                  Defaults to False.
      hide_depth (bool, optional): Hide number of features toggle.
                  Defaults to False.
      hide_popout (bool, optional): hide popout button
      hide_title (bool, optional): hide title. Defaults to False.
      hide_subtitle (bool, optional): Hide subtitle. Defaults to False.
      hide_selector (bool, optional): hide pos label selectors.
                  Defaults to False.
      pos_label ({int, str}, optional): initial pos label.
                  Defaults to explainer.pos_label
      importance_type (str, {'permutation', 'shap'} optional):
                  initial importance type to display. Defaults to "shap".
      depth (int, optional): Initial number of top features to display.
                  Defaults to None (=show all).
      no_permutations (bool, optional): Do not use the permutation
          importances for this component. Defaults to False.
      description (str, optional): Tooltip to display when hover over
          component title. When None default text is shown.
docstr_tok: ["Display","features","importances","component","Args",":","explainer","(","Explainer",")",":","explainer","object","constructed","with","either","ClassifierExplainer","(",")","or","RegressionExplainer","(",")","title","(","str",",","optional",")",":","Title","of","tab","or","page",".","Defaults","to","``","Feature","Importances","''",".","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",",","optional",")",":","Subtitle",".","hide_type","(","bool",",","optional",")",":","Hide","permutation\/shap","selector","toggle",".","Defaults","to","False",".","hide_depth","(","bool",",","optional",")",":","Hide","number","of","features","toggle",".","Defaults","to","False",".","hide_popout","(","bool",",","optional",")",":","hide","popout","button","hide_title","(","bool",",","optional",")",":","hide","title",".","Defaults","to","False",".","hide_subtitle","(","bool",",","optional",")",":","Hide","subtitle",".","Defaults","to","False",".","hide_selector","(","bool",",","optional",")",":","hide","pos","label","selectors",".","Defaults","to","False",".","pos_label","(","{","int",",","str","}",",","optional",")",":","initial","pos","label",".","Defaults","to","explainer.pos_label","importance_type","(","str",",","{","'permutation","'",",","'shap","'","}","optional",")",":","initial","importance","type","to","display",".","Defaults","to","``","shap","''",".","depth","(","int",",","optional",")",":","Initial","number","of","top","features","to","display",".","Defaults","to","None","(","=show","all",")",".","no_permutations","(","bool",",","optional",")",":","Do","not","use","the","permutation","importances","for","this","component",".","Defaults","to","False",".","description","(","str",",","optional",")",":","Tooltip","to","display","when","hover","over","component","title",".","When","None","default","text","is","shown","."]
code: def __init__(
      self,
      explainer,
      title="Feature Importances",
      name=None,
      subtitle="Which features had the biggest impact?",
      hide_type=False,
      hide_depth=False,
      hide_popout=False,
      hide_title=False,
      hide_subtitle=False,
      hide_selector=False,
      pos_label=None,
      importance_type="shap",
      depth=None,
      no_permutations=False,
      description=None,
      **kwargs,
  ):
      """Display features importances component
  
      Args:
          explainer (Explainer): explainer object constructed with either
                      ClassifierExplainer() or RegressionExplainer()
          title (str, optional): Title of tab or page. Defaults to
                      "Feature Importances".
          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, optional): Subtitle.
          hide_type (bool, optional): Hide permutation/shap selector toggle.
                      Defaults to False.
          hide_depth (bool, optional): Hide number of features toggle.
                      Defaults to False.
          hide_popout (bool, optional): hide popout button
          hide_title (bool, optional): hide title. Defaults to False.
          hide_subtitle (bool, optional): Hide subtitle. Defaults to False.
          hide_selector (bool, optional): hide pos label selectors.
                      Defaults to False.
          pos_label ({int, str}, optional): initial pos label.
                      Defaults to explainer.pos_label
          importance_type (str, {'permutation', 'shap'} optional):
                      initial importance type to display. Defaults to "shap".
          depth (int, optional): Initial number of top features to display.
                      Defaults to None (=show all).
          no_permutations (bool, optional): Do not use the permutation
              importances for this component. Defaults to False.
          description (str, optional): Tooltip to display when hover over
              component title. When None default text is shown.
      """
      super().__init__(explainer, title, name)
  
      assert importance_type in [
          "shap",
          "permutation",
      ], "importance type must be either 'shap' or 'permutation'!"
  
      if depth is not None:
          self.depth = min(
              depth, len(explainer.columns_ranked_by_shap())
          )
  
      self.selector = PosLabelSelector(
          explainer, name=self.name, pos_label=pos_label
      )
  
      if self.explainer.y_missing or self.no_permutations:
          self.hide_type = True
          self.importance_type = "shap"
      if self.description is None:
          self.description = f"""
          Shows the features sorted from most important to least important. Can 
          be either sorted by absolute SHAP value (average absolute impact of 
          the feature on final prediction) or by permutation importance (how much
          does the model get worse when you shuffle this feature, rendering it
          useless?).
          """
      self.popout = GraphPopout(
          "importances-" + self.name + "popout",
          "importances-graph-" + self.name,
          self.title,
          self.description,
      )
      self.register_dependencies("shap_values_df")
      if not (self.hide_type and self.importance_type == "shap"):
          self.register_dependencies("permutation_importances")
  
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 ImportancesComponent object from inherited base classes: ExplainerComponent with example: obj = ImportancesComponent(explainer, title, name, subtitle, hide_type, hide_depth, hide_popout, hide_title, hide_subtitle, hide_selector, pos_label, importance_type, depth, no_permutations, description)