class_docstr: Implementation of Fredrikson et al. white box inference attack for decision trees.
  
  Assumes that the attacked feature is discrete or categorical, with limited number of possible values. For example:
  a boolean feature.
  
  | Paper link: https://dl.acm.org/doi/10.1145/2810103.2813677
class_docstr_tok: ["Implementation","of","Fredrikson","et","al",".","white","box","inference","attack","for","decision","trees",".","Assumes","that","the","attacked","feature","is","discrete","or","categorical",",","with","limited","number","of","possible","values",".","For","example",":","a","boolean","feature",".","|","Paper","link",":","https",":","\/\/dl.acm.org\/doi\/10.1145\/2810103.2813677"]
code: def _calculate_phi(self, x, values, n_samples):
      phi = []
      for value in values:
          v_full = np.full((n_samples, 1), value).astype(x.dtype)
          x_value = np.concatenate(
              (x[:, : self.attack_feature], v_full), axis=1
          )
          x_value = np.concatenate(
              (x_value, x[:, self.attack_feature :]), axis=1
          )
          nodes_value = {}
  
          for row in x_value:
              # get leaf ids (no duplicates)
              node_id = self.estimator.get_decision_path([row])[-1]
              nodes_value[node_id] = self.estimator.get_samples_at_node(
                  node_id
              )
          # sum sample numbers
          num_value = sum(nodes_value.values()) / n_samples
          phi.append(num_value)
  
      return phi
  
file_path: adversarial-robustness-toolbox/art/attacks/inference/attribute_inference/white_box_lifestyle_decision_tree.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  from typing import Optional, Union, TYPE_CHECKING
  import numpy
  from art.attacks.attack import AttributeInferenceAttack
  from art.estimators.classification.scikitlearn import ScikitlearnDecisionTreeClassifier
  from art.estimators.regression.scikitlearn import ScikitlearnDecisionTreeRegressor
label_desc: Use image node_id 3 for calling the AttributeInferenceWhiteBoxLifestyleDecisionTree obj's underlying member method code with example usage: obj._calculate_phi(x, values, n_samples) and returns: phi