-
Notifications
You must be signed in to change notification settings - Fork 6
/
tutorialCalcPL.m
46 lines (35 loc) · 1.82 KB
/
tutorialCalcPL.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
% Hi liquan, here is a piece of code for you :)
% Run the code, you can find the output is as same as the numbers in line(ii) of Fig3(a) in ICDE17 paper https://arxiv.org/abs/1610.07543
% see the following comments, about how to use calcPL
clc
% specify the parameters
TM=[0.8,0.2; 0,1]; % moderate temporal corr.
e=0.1; % means epsilon at each t (note: it can be different at each t)
PL=0; % means the privacy leakage at t=1 (for BPL) or the privacy leakage at t=T (for FPL); T means the last/current time point
% function `preCompQDMatrix` needs some code in tools folder
addpath('tools/');
% frist run the following line to get pre-computed results `EspMatrix`, `qM`, `dM`
[EspMatrix, qM, dM, ~]= preCompQDMatrix(TM);
% then, at each timestamp, you can (re)use these pre-computed results in calculating the (backward
% or forward) privacy leakage
% note that, the e at each t can be different
PL = calcPL(PL, e, EspMatrix, qM, dM) % t=1
PL = calcPL(PL, e, EspMatrix, qM, dM) % t=2
PL = calcPL(PL, e, EspMatrix, qM, dM) % t=3
PL = calcPL(PL, e, EspMatrix, qM, dM) % t=4
PL = calcPL(PL, e, EspMatrix, qM, dM) % t=5
PL = calcPL(PL, e, EspMatrix, qM, dM) % t=6
PL = calcPL(PL, e, EspMatrix, qM, dM) % t=7
PL = calcPL(PL, e, EspMatrix, qM, dM) % t=8
PL = calcPL(PL, e, EspMatrix, qM, dM) % t=9
PL = calcPL(PL, e, EspMatrix, qM, dM) % t=10
% what is the difference between BPL and FPL? (assume backward TM = forward TM)
% BPL at t = calcPL(BPL at t-1, e at t, EspMatrix, qM, dM)
% if t=1, BPL=0;
% FPL at t = calcPL(FPL at t+1, e at t, EspMatrix, qM, dM)
% if t=the current/last (you haven't release the next data), FPL=0.
% what is TPL?
% TPL_t = BPL_t + FPL_t - e_t
% note: when t=2, BPL_1 keeps the same, but FPL_1 is changing (larger or the same).
% you can try to think: how to draw line(ii), i.e. TPL, in Fig3(c) in ICDE17 paper?
% Good luck!