growingspheres/growingfields.py
def ennemies_in_layer_(self, segment, caps=None, n=1000, reducing_sphere=False):
        """
        Basis for GS: generates a hypersphere layer, labels it with the blackbox 
        and returns the instances that are predicted to belong to the target class.
        """
        if self.categorical_features != []:
            # If there are categorical features we must have a maximum distribution probability for changing the values of categorical feature for artificial instances
            if self.farthest_distance_training_dataset is None:
                print("you must initialize a distance for the percentage distribution")
            else:
                # Initialize the percentage of categorical features that are changed 
                percentage_distribution = segment[1]/self.farthest_distance_training_dataset*100
            layer = generate_categoric_inside_ball(center= self.obs_to_interprete, segment=segment, n=n, percentage_distribution=percentage_distribution,
                                            continuous_features=self.continuous_features, categorical_features=self.categorical_features, 
                                            categorical_values=self.categorical_values, feature_variance= self.feature_variance,
                                            probability_categorical_feature=self.probability_categorical_feature,
                                            min_features=self.min_features, max_features=self.max_features)
        else:
            layer = generate_inside_field(self.obs_to_interprete, segment, n, feature_variance=self.feature_variance, 
                                        max_features=self.max_features, min_features=self.min_features)
        
        #cap here: not optimal
        if caps != None:
            cap_fn_ = lambda x: min(max(x, caps[0]), caps[1])
            layer = np.vectorize(cap_fn_)(layer)
        preds_ = self.prediction_fn(layer)
        if self.target_other:
            return layer[np.where(preds_ != self.target_class)]
        return layer[np.where(preds_ == self.target_class)]

        Basis for GS: generates a hypersphere layer, labels it with the blackbox 
        and returns the instances that are predicted to belong to the target class.
        
Basis for GS: generates a hypersphere layer, labels it with the blackbox
and returns the instances that are predicted to belong to the target class.
Basis for GS : generates a hypersphere layer labels it with the blackbox and returns the instances that are predicted to belong to the target class .
def ennemies_in_layer_(self, segment, caps=None, n=1000, reducing_sphere=False):
        if self.categorical_features != []:
            if self.farthest_distance_training_dataset is None:
                print("you must initialize a distance for the percentage distribution")
            else:
                percentage_distribution = segment[1]/self.farthest_distance_training_dataset*100
            layer = generate_categoric_inside_ball(center= self.obs_to_interprete, segment=segment, n=n, percentage_distribution=percentage_distribution,
                                            continuous_features=self.continuous_features, categorical_features=self.categorical_features, 
                                            categorical_values=self.categorical_values, feature_variance= self.feature_variance,
                                            probability_categorical_feature=self.probability_categorical_feature,
                                            min_features=self.min_features, max_features=self.max_features)
        else:
            layer = generate_inside_field(self.obs_to_interprete, segment, n, feature_variance=self.feature_variance, 
                                        max_features=self.max_features, min_features=self.min_features)
        if caps != None:
            cap_fn_ = lambda x: min(max(x, caps[0]), caps[1])
            layer = np.vectorize(cap_fn_)(layer)
        preds_ = self.prediction_fn(layer)
        if self.target_other:
            return layer[np.where(preds_ != self.target_class)]
        return layer[np.where(preds_ == self.target_class)]
def ennemies_in_layer_ ( self , segment , caps = None , n = 1000 , reducing_sphere = False ) : if self . categorical_features != [ ] : if self . farthest_distance_training_dataset is None : print ( "you must initialize a distance for the percentage distribution" ) else : percentage_distribution = segment [ 1 ] / self . farthest_distance_training_dataset * 100 layer = generate_categoric_inside_ball ( center = self . obs_to_interprete , segment = segment , n = n , percentage_distribution = percentage_distribution , continuous_features = self . continuous_features , categorical_features = self . categorical_features , categorical_values = self . categorical_values , feature_variance = self . feature_variance , probability_categorical_feature = self . probability_categorical_feature , min_features = self . min_features , max_features = self . max_features ) else : layer = generate_inside_field ( self . obs_to_interprete , segment , n , feature_variance = self . feature_variance , max_features = self . max_features , min_features = self . min_features ) if caps != None : cap_fn_ = lambda x : min ( max ( x , caps [ 0 ] ) , caps [ 1 ] ) layer = np . vectorize ( cap_fn_ ) ( layer ) preds_ = self . prediction_fn ( layer ) if self . target_other : return layer [ np . where ( preds_ != self . target_class ) ] return layer [ np . where ( preds_ == self . target_class ) ]
Basis for GS: generates a hypersphere layer, labels it with the blackbox
and returns the instances that are predicted to belong to the target class.
Basis for GS : generates a hypersphere layer labels it with the blackbox and returns the instances that are predicted to belong to the target class .
"""
        Basis for GS: generates a hypersphere layer, labels it with the blackbox 
        and returns the instances that are predicted to belong to the target class.
        """ # If there are categorical features we must have a maximum distribution probability for changing the values of categorical feature for artificial instances # Initialize the percentage of categorical features that are changed  #cap here: not optimal
self
segment
caps
n
reducing_sphere