def score(self, key_data, sensitive_data): ref_key_attributes = closest_neighbors(self.synthetic_dict.keys(), key_data) ref_sensitive_attributes = [] for key in ref_key_attributes: ref_sensitive_attributes.extend(self.synthetic_dict[key]) return count_frequency(ref_sensitive_attributes, sensitive_data)
def score(self, key_data, sensitive_data): """Score based on the belief of the attacker, in the form P(sensitive_data|key|data). Args: key_data (tuple): The key data. sensitive_data (tuple): The sensitive data. Returns: float or None: The frequency of the correct sensitive entry. Returns `0` if the key is not in the data. """ if key_data in self.synthetic_dict: return count_frequency(self.synthetic_dict[key_data], sensitive_data) else: return 0
def score(self, key_data, sensitive_data): """Score based on the belief of the attacker, in the form P(sensitive_data|key|data). Args: key_data (tuple): The key data. sensitive_data (tuple): The sensitive data. Returns: float or None: The frequency of the correct sensitive entry. """ ref_key_attributes = closest_neighbors(self.synthetic_dict.keys(), key_data) ref_sensitive_attributes = [] for key in ref_key_attributes: ref_sensitive_attributes.extend(self.synthetic_dict[key]) return count_frequency(ref_sensitive_attributes, sensitive_data)
def score(self, key_data, sensitive_data): if key_data in self.synthetic_dict: return count_frequency(self.synthetic_dict[key_data], sensitive_data) else: return 0