diff --git a/hics/contrast_meassure.py b/hics/contrast_meassure.py index 4c5d637..dbfd51f 100644 --- a/hics/contrast_meassure.py +++ b/hics/contrast_meassure.py @@ -31,14 +31,14 @@ def __init__(self, data, alpha, iterations, continuous_divergence = KS, categori else: self.types[column] = 'continuous' - def values(self, feature): + def get_values(self, feature): if not feature in self.values: return False else: return self.values[feature] - def type(self, feature): + def get_type(self, feature): if not feature in self.types: return False @@ -102,7 +102,7 @@ def output_slices(self, score, conditions, slices): ft = condition['feature'] if self.types[ft] == 'categorical': - to_append = [1*(value in condition['values']) for value in self.values(ft)] + to_append = [1*(value in condition['values']) for value in self.get_values(ft)] if ft in slices['features']: slices['features'][ft].append(to_append) else: diff --git a/hics/incremental_correlation.py b/hics/incremental_correlation.py index e34add9..bf33f01 100644 --- a/hics/incremental_correlation.py +++ b/hics/incremental_correlation.py @@ -15,7 +15,7 @@ def __init__(self, data, target, result_storage, iterations = 10, alpha = 0.1, d self.features = [str(ft) for ft in data.columns.values if str(ft) != target] if drop_discrete: - self.features = [ft for ft in self.features if self.subspace_contrast.types[ft] != 'discrete'] + self.features = [ft for ft in self.features if self.subspace_contrast.get_type(ft) != 'discrete'] self.result_storage = result_storage @@ -63,8 +63,8 @@ def _relevancy_dict_to_df(self, new_scores): def _add_slices_to_dict(self, subspace, slices, slices_store): subspace_tuple = tuple(sorted(subspace)) if not subspace_tuple in slices_store: - categorical = [{'name' : ft, 'values' : self.subspace_contrast.values(ft)} for ft in subspace if self.subspace_contrast.type(ft) == 'categorical'] - continuous = [ft for ft in subspace if self.subspace_contrast.type(ft) == 'continuous'] + categorical = [{'name' : ft, 'values' : self.subspace_contrast.get_values(ft)} for ft in subspace if self.subspace_contrast.get_type(ft) == 'categorical'] + continuous = [ft for ft in subspace if self.subspace_contrast.get_type(ft) == 'continuous'] slices_store[subspace_tuple] = ScoredSlices(categorical, continuous) slices_store[subspace_tuple].add_slices(slices)