lmdk_sel: Tested the Eucl distance in exp_mech

This commit is contained in:
Manos Katsomallos 2021-10-12 12:04:00 +02:00
parent 0b1ce3cbbc
commit 5b81702d37
4 changed files with 23 additions and 22 deletions

View File

@ -11,7 +11,8 @@ from matplotlib import pyplot as plt
import time import time
''' def score(data, option):
'''
The scoring function. The scoring function.
Parameters: Parameters:
@ -19,12 +20,13 @@ import time
option - The option to evaluate. option - The option to evaluate.
Returns: Returns:
The score for the option. The score for the option.
''' '''
def score(data, option):
return (option.sum() - data.sum()) return (option.sum() - data.sum())
# return lmdk_lib.get_norm(data, option)
''' def exponential(x, R, u, delta, epsilon):
'''
The exponential mechanism. The exponential mechanism.
Parameters: Parameters:
@ -36,8 +38,7 @@ def score(data, option):
Returns: Returns:
res - A randomly sampled output. res - A randomly sampled output.
pr - The PDF of all possible outputs. pr - The PDF of all possible outputs.
''' '''
def exponential(x, R, u, delta, epsilon):
# Calculate the score for each element of R # Calculate the score for each element of R
scores = [u(x, r) for r in R] scores = [u(x, r) for r in R]
# Normalize the scores between 0 and 1 # Normalize the scores between 0 and 1

Binary file not shown.

Binary file not shown.

Binary file not shown.