You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please specify SDC tool used: (mu-argus, sdcMicro, sdcMicroGUI, tau-argus, sdcTable) Version used: Operating system used: (Windows, Linux)
I am using sdcMicro 5.7.1 on Windows.
When I use ldiversity function with a sensitive variable that has many missing values, I get indices 1 when the sensitive variable is missing. As I understand, if the sensitive variable is missing then there is no disclosure issue related to the sensitive variable and the ldiversity index should not be 1.
I wonder if I am missing something or the calculation is incorrect?
Rows 1, 2, 3 have l-diveristy 1. However, no disclosure issue here, since the sensitive variable is missing. Rows 7, 8 and 9 should also not pose concern in terms of l-diversity.
This is creating a problem because I cannot tell based on the l-diveristy column where are the disclosure risks. At least for me, it would make more sense if whenever there is at least one missing in the key, the l-diversity would be NA.
@msanches35 i agree that the implementation of l-diversity risk is somewhat ambiguous. i just tried the following as the underlying c++ code does not seem to work well with NAs; i just tried this (using example.data as starting-point):
key1 key2 key3 health id health_int l_diversity_int l_diversity
1 Do not know Elective <NA> NA 4 -1 0 1
2 Do not know Elective <NA> NA 42 -1 0 1
3 Do not know Elective <NA> NA 59 -1 0 1
4 Female Elective CENTRAL NA 20 -1 0 3
5 Female Elective CENTRAL NA 24 -1 0 3
6 Female Elective CENTRAL NA 54 -1 0 3
7 Female Elective CENTRAL EAST NA 7 -1 0 1
8 Female Elective CENTRAL WEST NA 72 -1 0 1
9 Female Elective ERIE ST. CLAIR NA 73 -1 0 1
10 Female Elective TORONTO CENTRAL NA 16 -1 2 3
11 Female Elective TORONTO CENTRAL 5 21 5 2 3
12 Female Elective TORONTO CENTRAL NA 68 -1 2 3
13 Female Elective <NA> NA 9 -1 0 1
14 Female Elective <NA> 4 25 4 1 1
15 Female Elective <NA> 3 28 3 1 1
16 Female Elective <NA> NA 36 -1 0 1
17 Female Elective <NA> NA 38 -1 0 1
18 Female Elective <NA> 10 43 10 1 1
19 Female Elective <NA> NA 57 -1 0 1
20 Female Elective <NA> NA 67 -1 0 1
which are more plausible results; i guess we probably should provide a possibility to allow (automatic) recoding of missings in the ldiv_index so some (unused) integer-variable or at least add a message that using NA might lead to unexpected results.
Thanks, the results do make more sense, I think it will help me to get an useful ldiversity index! But there are still some inconsistencies in my view:
Rows 10:12 - Given that NA can be anything, I think index should be 3; or it should simply be 0 every time there is at least one NA in the sensitive variable.
Rows 14 and 15 and 18 should not be 1. However, I think this may be resolved if we simply recode the NA in key3 into some non-NA value.
i have now done some investigation, but before comitting these I want to gather some feedback on "edge-cases"; the most-simple case (so missing values) is trivial and the expected results should be non-ombiguous.
> df
key1 health ldiv
1 a 1 3
2 a 1 3
3 a 2 3
4 a 3 3
5 b 5 1
6 b 5 1
in the data.frame from above, ldiv should report values 3 (for key1 == a) and 1 (for key1 == b) given sensitive variable health; it is however not 100% clear (at least to me) what the expected results are if there a missing values in the sensitive-variable (given a complete key);
> df
key1 health
1 a NA
2 a NA
3 a 1
the current implementation counts each NA (in the sensitive variable) as separate, unique value; therefore in the data.frame from above, the result of the ldiv-measure would be 3. If you however have a unique key (fk = 1 / a single row in the data.frame as shown below)
> df
key1 health
1 a NA
and the information in the sensitive-varible is missing, the result (using this logic) would be 1 even though there is obviously no disclosure problem (because the value in the sensitive-variable is completely missing). but any data.frame with such a key could not be e.g 2-diverse. in this case, i would have expected the result to be either the total number of characteristics in the sensitive variable over the entire data.set or even NA. on the other hand, it would also be perfectly fine to argue that since this key has a value of fk=1 (sample unique) it would violate 2-anonymity and therefore would also of course have to violate 2-diversity which would make the value of 1 for the ldiv-measure “explainable”.
another issue that currently leads to results that I was not really expecting is that for keys that are completely missing (NA in all key-variables), the ldiversity-measure yields a value of 0. in this case, I would have expected NA or even the total number of possible characteristics in the sensitive variable over the entire dataset but certainly not 0.
We are back to the old problem about frequency estimation with missing values. Mustn't we argue with probabilities that a NA is of a certain category.
With assumptions that the attacker predictive power is zero to estimate NA's correctly, knowledge how many different categories exists (reasonable assumption) and that the frequencies are balanced and does not depend on other variables:
> df
key1 health l-diversity
1 a NA 2.111
2 a NA 2.111
3 a 1 1
To see how to get to 2.111 is best to draw a decision tree. The probability of NA beging 1, 2 or 3 is 1/3 of each NA, so you can have with probability 1/9 the events 1,1,1 with outcome 1, then 2,1,1 --> 2, then 3,1,1 --> 2, then 1,2,1 --> 2, then 2,2,1 --> 2,then 3,2,1 --> 3, then 1,3,1 --> 2, then 2,3,1 --> 3, then 3,3,1 --> 2 thus 1+2+2+2+2+3+2+3+2 = 19 and l-div of 19/9 = 2.1111)
This seems manageable to calculate in general. But what if these assumptions does not hold? If the assumption on balanced frequencies does not hold, this is still manageable.
The probabilities based on observed frequencies are then --> assume they are 1/6, 2/6, 3/6 that NA is category 1, 2, or 3 in the example. Then we get
11/36 + 21/18 + 21/12 + 21/18 + 21/9 + 31/6 +2* 1/12 + 31/6 + 21/4 = 2.305
If the attacker can build a model with some good predictive power to estimate the NA's correctly then I feel lost to estimate the l-diversity under missing values.
What I wanted to express is that the estimation of l-diversity is only straightforward when restrictive assumptions are made. Your assumptions are even stronger than mine above.
Sorry about the delay on this. Here is what I thought, in case you are still looking into this.
I think I understand the point.
Maybe a practical approach. I like the calculation that lead to 2.111 in the example, it could be the default. And maybe an option for the user to set the l-div = NA when sensitive variable = NA (although that is easy to do in case one does not agree with the use of the equal frequency). Counting NA as different values could be another option for the user, the best case-scenario.
In the example above, I don't understand why l-div = 1 for the last line. It seems to me that this l-diversity depends on the NA. When an invader sees that key1 = a, they still dont know what is the value for "health", therefore a subject for whom key1 = a is not at risk of having their health value disclosed. So, it would be 2.111 by default, or 3 in the best case scenario, or NA if the users chooses to do so. The fact that l-div = 1 in that last line and I am not able to agree with it, is the only thing that is impeding me to use the 'ldiversity' function in my application right now.
Activity
bernhard-da commentedon Aug 16, 2022
hi @msanches35 ; could you please provide a quick reproducible example using
ldiversity()? thx!msanches35 commentedon Aug 17, 2022
Here is a reproducible example, based on Table 4 from the sdcMicro paper.
Rows 1, 2, 3 have l-diveristy 1. However, no disclosure issue here, since the sensitive variable is missing. Rows 7, 8 and 9 should also not pose concern in terms of l-diversity.
This is creating a problem because I cannot tell based on the l-diveristy column where are the disclosure risks. At least for me, it would make more sense if whenever there is at least one missing in the key, the l-diversity would be NA.
Thanks!
bernhard-da commentedon Aug 18, 2022
@msanches35 thx a lot. i will have a look.
bernhard-da commentedon Aug 18, 2022
@msanches35 i agree that the implementation of l-diversity risk is somewhat ambiguous. i just tried the following as the underlying c++ code does not seem to work well with
NAs; i just tried this (usingexample.dataas starting-point):which gave
which are more plausible results; i guess we probably should provide a possibility to allow (automatic) recoding of missings in the
ldiv_indexso some (unused) integer-variable or at least add a message that using NA might lead to unexpected results.msanches35 commentedon Aug 22, 2022
Thanks, the results do make more sense, I think it will help me to get an useful ldiversity index! But there are still some inconsistencies in my view:
Rows 10:12 - Given that NA can be anything, I think index should be 3; or it should simply be 0 every time there is at least one NA in the sensitive variable.
Rows 14 and 15 and 18 should not be 1. However, I think this may be resolved if we simply recode the NA in key3 into some non-NA value.
Thanks again!
bernhard-da commentedon Sep 29, 2022
i have now done some investigation, but before comitting these I want to gather some feedback on "edge-cases"; the most-simple case (so missing values) is trivial and the expected results should be non-ombiguous.
in the
data.framefrom above, ldiv should report values3(forkey1 == a) and1(forkey1 == b) given sensitive variablehealth; it is however not 100% clear (at least to me) what the expected results are if there a missing values in the sensitive-variable (given a complete key);the current implementation counts each
NA(in the sensitive variable) as separate, unique value; therefore in the data.frame from above, the result of the ldiv-measure would be3. If you however have a unique key (fk = 1/ a single row in the data.frame as shown below)and the information in the sensitive-varible is missing, the result (using this logic) would be
1even though there is obviously no disclosure problem (because the value in the sensitive-variable is completely missing). but anydata.framewith such a key could not be e.g2-diverse. in this case, i would have expected the result to be either the total number of characteristics in the sensitive variable over the entire data.set or evenNA. on the other hand, it would also be perfectly fine to argue that since this key has a value offk=1(sample unique) it would violate 2-anonymity and therefore would also of course have to violate2-diversity which would make the value of1for the ldiv-measure “explainable”.another issue that currently leads to results that I was not really expecting is that for keys that are completely missing (
NAin all key-variables), the ldiversity-measure yields a value of0. in this case, I would have expectedNAor even the total number of possible characteristics in the sensitive variable over the entire dataset but certainly not0.what are your thoughts on this?
matthias-da commentedon Sep 29, 2022
We are back to the old problem about frequency estimation with missing values. Mustn't we argue with probabilities that a NA is of a certain category.
With assumptions that the attacker predictive power is zero to estimate NA's correctly, knowledge how many different categories exists (reasonable assumption) and that the frequencies are balanced and does not depend on other variables:
To see how to get to 2.111 is best to draw a decision tree. The probability of NA beging 1, 2 or 3 is 1/3 of each NA, so you can have with probability 1/9 the events 1,1,1 with outcome 1, then 2,1,1 --> 2, then 3,1,1 --> 2, then 1,2,1 --> 2, then 2,2,1 --> 2,then 3,2,1 --> 3, then 1,3,1 --> 2, then 2,3,1 --> 3, then 3,3,1 --> 2 thus 1+2+2+2+2+3+2+3+2 = 19 and l-div of 19/9 = 2.1111)
This seems manageable to calculate in general. But what if these assumptions does not hold? If the assumption on balanced frequencies does not hold, this is still manageable.
The probabilities based on observed frequencies are then --> assume they are 1/6, 2/6, 3/6 that NA is category 1, 2, or 3 in the example. Then we get
11/36 + 21/18 + 21/12 + 21/18 + 21/9 + 31/6 +2* 1/12 + 31/6 + 21/4 = 2.305
If the attacker can build a model with some good predictive power to estimate the NA's correctly then I feel lost to estimate the l-diversity under missing values.
What I wanted to express is that the estimation of l-diversity is only straightforward when restrictive assumptions are made. Your assumptions are even stronger than mine above.
msanches35 commentedon May 24, 2024
Sorry about the delay on this. Here is what I thought, in case you are still looking into this.
I think I understand the point.
Maybe a practical approach. I like the calculation that lead to 2.111 in the example, it could be the default. And maybe an option for the user to set the l-div = NA when sensitive variable = NA (although that is easy to do in case one does not agree with the use of the equal frequency). Counting NA as different values could be another option for the user, the best case-scenario.
In the example above, I don't understand why l-div = 1 for the last line. It seems to me that this l-diversity depends on the NA. When an invader sees that key1 = a, they still dont know what is the value for "health", therefore a subject for whom key1 = a is not at risk of having their health value disclosed. So, it would be 2.111 by default, or 3 in the best case scenario, or NA if the users chooses to do so. The fact that l-div = 1 in that last line and I am not able to agree with it, is the only thing that is impeding me to use the 'ldiversity' function in my application right now.
Thank you!