class_docstr: A class for feature importance methods.
class_docstr_tok: ["A","class","for","feature","importance","methods","."]
docstr: Rank features based on the chosen divergence measure.
  
  Args:
      data (pd.Dataframe): DataFrame containing outcome, features, and experiment group
      treatment_indicator (string): the column name for binary indicator of treatment (value 1) or control (value 0)
      features (list of string): list of feature names, that are columns in the data DataFrame
      y_name (string): name of the outcome variable
      method (string, optional, default = 'KL'): taking one of the following values {'F', 'LR', 'KL', 'ED', 'Chi'}
              The feature selection method to be used to rank the features.
              'F' for F-test
              'LR' for likelihood ratio test
              'KL', 'ED', 'Chi' for bin-based uplift filter methods, KL divergence, Euclidean distance, Chi-Square respectively
      experiment_group_column (string, optional, default = 'treatment_group_key'): the experiment column name in the DataFrame, which contains the treatment and control assignment label
      control_group (string, optional, default = 'control'): name for control group, value in the experiment group column
      n_bins (int, optional, default = 10): number of bins to be used for bin-based uplift filter methods
      null_impute (str, optional, default=None): impute np.nan present in the data taking on of the following strategy values {'mean', 'median', 'most_frequent', None}. If Value is None and null is present then exception will be raised
  
  Returns:
      all_result : pd.DataFrame
          a data frame containing the feature importance statistics
docstr_tok: ["Rank","features","based","on","the","chosen","divergence","measure",".","Args",":","data","(","pd.Dataframe",")",":","DataFrame","containing","outcome",",","features",",","and","experiment","group","treatment_indicator","(","string",")",":","the","column","name","for","binary","indicator","of","treatment","(","value","1",")","or","control","(","value","0",")","features","(","list","of","string",")",":","list","of","feature","names",",","that","are","columns","in","the","data","DataFrame","y_name","(","string",")",":","name","of","the","outcome","variable","method","(","string",",","optional",",","default","=","'KL","'",")",":","taking","one","of","the","following","values","{","'","F","'",",","'LR","'",",","'KL","'",",","'ED","'",",","'Chi","'","}","The","feature","selection","method","to","be","used","to","rank","the","features",".","'","F","'","for","F-test","'LR","'","for","likelihood","ratio","test","'KL","'",",","'ED","'",",","'Chi","'","for","bin-based","uplift","filter","methods",",","KL","divergence",",","Euclidean","distance",",","Chi-Square","respectively","experiment_group_column","(","string",",","optional",",","default","=","'treatment_group_key","'",")",":","the","experiment","column","name","in","the","DataFrame",",","which","contains","the","treatment","and","control","assignment","label","control_group","(","string",",","optional",",","default","=","'control","'",")",":","name","for","control","group",",","value","in","the","experiment","group","column","n_bins","(","int",",","optional",",","default","=","10",")",":","number","of","bins","to","be","used","for","bin-based","uplift","filter","methods","null_impute","(","str",",","optional",",","default=None",")",":","impute","np.nan","present","in","the","data","taking","on","of","the","following","strategy","values","{","'mean","'",",","'median","'",",","'most_frequent","'",",","None","}",".","If","Value","is","None","and","null","is","present","then","exception","will","be","raised","Returns",":","all_result",":","pd.DataFrame","a","data","frame","containing","the","feature","importance","statistics"]
code: def filter_D(
      self,
      data,
      features,
      y_name,
      n_bins=10,
      method="KL",
      control_group="control",
      experiment_group_column="treatment_group_key",
      null_impute=None,
  ):
      """
      Rank features based on the chosen divergence measure.
  
      Args:
          data (pd.Dataframe): DataFrame containing outcome, features, and experiment group
          treatment_indicator (string): the column name for binary indicator of treatment (value 1) or control (value 0)
          features (list of string): list of feature names, that are columns in the data DataFrame
          y_name (string): name of the outcome variable
          method (string, optional, default = 'KL'): taking one of the following values {'F', 'LR', 'KL', 'ED', 'Chi'}
                  The feature selection method to be used to rank the features.
                  'F' for F-test
                  'LR' for likelihood ratio test
                  'KL', 'ED', 'Chi' for bin-based uplift filter methods, KL divergence, Euclidean distance, Chi-Square respectively
          experiment_group_column (string, optional, default = 'treatment_group_key'): the experiment column name in the DataFrame, which contains the treatment and control assignment label
          control_group (string, optional, default = 'control'): name for control group, value in the experiment group column
          n_bins (int, optional, default = 10): number of bins to be used for bin-based uplift filter methods
          null_impute (str, optional, default=None): impute np.nan present in the data taking on of the following strategy values {'mean', 'median', 'most_frequent', None}. If Value is None and null is present then exception will be raised
  
      Returns:
          all_result : pd.DataFrame
              a data frame containing the feature importance statistics
      """
  
      all_result = pd.DataFrame()
  
      for x_name_i in features:
          one_result = self._filter_D_one_feature(
              data=data,
              feature_name=x_name_i,
              y_name=y_name,
              n_bins=n_bins,
              method=method,
              control_group=control_group,
              experiment_group_column=experiment_group_column,
              null_impute=null_impute,
          )
          all_result = pd.concat([all_result, one_result])
  
      all_result = all_result.sort_values(by="score", ascending=False)
      all_result["rank"] = all_result["score"].rank(ascending=False)
  
      return all_result
  
imports: import numpy
  import pandas
  import statsmodels.api
  from scipy import stats
  from sklearn.impute import SimpleImputer
  import warnings
label_desc: Use image node_id 12 for calling the FilterSelect obj's underlying member method code with example usage: obj.filter_D(data, features, y_name, n_bins, method, control_group, experiment_group_column, null_impute) and returns: all_result