Full text
Evaluation of δ-DOCA on online machine learning Master Thesis submitted to the Faculty of the Escola T`ecnica d’Enginyeria de Telecomunicaci´o de Barcelona Universitat Polit`ecnica de Catalunya by Jorge Matas Garc´ıa In partial fulfillment of the requirements for the master in CYBERSECURITY Advisors: Javier Parra Arnau & Adri´an Tobar Nicolau Barcelona, 2022
Contents List of Figures 3 1 Introduction 5 1.1 Objectives.................................... 6 1.2 Requirements and specifications . . . . . . . . . . . . . . . . . . . . . . . . 7 1.3 Methods and procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.4 Deviations from the initial plan . . . . . . . . . . . . . . . . . . . . . . . . 7 2 State of the art 9 2.1 Differentialprivacy ............................... 9 2.2 Data protection algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.2.1 δ-DOCA................................. 9 2.3 Frameworks for evaluating data protection algorithms . . . . . . . . . . . . 10 2.4 Membership Inference Attack . . . . . . . . . . . . . . . . . . . . . . . . . 11 3 Methodology and project development 12 3.1 Requirements .................................. 12 3.2 Cross-validation................................. 12 3.3 Utilitymetrics.................................. 13 3.4 Building the analysis function . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.5 Additional improvements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4 Results 17 4.1 Models cross-validation scores . . . . . . . . . . . . . . . . . . . . . . . . . 17 4.2 Utilitymetrics.................................. 18 4.3 ROCcurves................................... 26 5 Conclusions and future development 28 5.1 Futuredevelopment............................... 28 5.1.1 Adding additional algorithms . . . . . . . . . . . . . . . . . . . . . 28 5.1.2 Evaluating regression . . . . . . . . . . . . . . . . . . . . . . . . . . 28 5.1.3 Continuous data publication . . . . . . . . . . . . . . . . . . . . . . 29 References 30 2
List of Figures 1 Overview of δ-DOCA anonymization algorithm. Source: [2] .......... 10 2 Laplace Distribution with µ= 0 and different values of ∆. Source: AstroML . 10 4 Diagram of cross-validation using k-fold strategy. Source: Wikipedia ..... 13 5 Box plot of cross-validation scores with original data. . . . . . . . . . . . . 17 6 Box plot of cross-validation scores applying δ-DOCA algorithm with ϵ= 500. 17 7 Box plot of cross-validation scores applying δ-DOCA algorithm with ϵ= 100. 17 8 Box plot of cross-validation scores applying δ-DOCA algorithm with ϵ= 50. 17 9 Box plot of cross-validation scores applying δ-DOCA algorithm with ϵ= 10. 18 10 Box plot of cross-validation scores applying δ-DOCA algorithm with ϵ= 1. 18 11 Utility metrics of the original data. . . . . . . . . . . . . . . . . . . . . . . 19 12 Utility metrics of the anonymized data with ϵ=500. ............ 19 13 Utility metrics of the anonymized data with ϵ=100. ............ 19 14 Utility metrics of the anonymized data with ϵ=50.............. 19 15 Utility metrics of the anonymized data with ϵ=10.............. 19 16 Utility metrics of the anonymized data with ϵ=1............... 19 17 Confusion matrices of the original data. . . . . . . . . . . . . . . . . . . . . 20 18 Confusion matrices of the anonymized data with ϵ=500........... 21 19 Confusion matrices of the anonymized data with ϵ=100........... 22 20 Confusion matrices of the anonymized data with ϵ=50. .......... 23 21 Confusion matrices of the anonymized data with ϵ=10. .......... 24 22 Confusion matrices of the anonymized data with ϵ=1. ........... 25 23 ROC curves of the models with original data. . . . . . . . . . . . . . . . . 26 24 ROC curves of the models with anonymized data with ϵ= 500. . . . . . . . 26 25 ROC curves of the models with anonymized data with ϵ= 100. . . . . . . . 27 26 ROC curves of the models with anonymized data with ϵ= 50. . . . . . . . 27 27 ROC curves of the models with anonymized data with ϵ= 10. . . . . . . . 27 28 ROC curves of the models with anonymized data with ϵ=1......... 27 3
Abstract Data anonymization is an important tool for protecting personal privacy and prevent identification of individuals. δ-DOCA is a semantic anonymization algorithm that protects datasets by modifying them such that they are similar to the original dataset in a semantic sense, while ensuring that the original dataset cannot be re-identified. This thesis proposes a framework that, using Machine Learning techniques, evaluates to what extent the protected data reveals information about the original data and the impact of this protection on the quality of the data. This is done by training a set of models with the protected data and comparing their performance to the performance of models trained with the original data. Results show that the protection deteriorates the quality of the data, which is reflected in the performance of the models, and that there is a trade-off between privacy and accuracy. 4
1 Introduction Nowadays, data is one of the most important things we have. It helps us understand the world around us and is essential in the research and development process. It helps companies understand the problem or opportunity, formulate hypotheses, design experiments, and analyze the results. Data also helps companies make better decisions. Thanks to it, companies can understand what works and what doesn’t work. They can also understand how their products or services are being used and what improvements can be made. Data is also important for the communication of results. It is used to create graphs, charts, and other visuals that help communicate the results of the research and development work. However, often data can contain sensitive information about people that could be used in wrong ways. That is why, when working with sensitive data, it is important to take measures to protect it. This includes getting explicit consent from people before collecting or sharing their data, keeping data confidential and secure, and anonymizing data before storing or sharing it. This last step is crucial in order to protect people’s personal information and privacy. When data is anonymized, it is stripped of all identifying information so that it can no longer be linked trivially to an individual, which means that individuals can no longer be identified from the data. This ensures that private information remains confidential and safe from unauthorized access. It also means that researchers can use the data without fear of violating people’s privacy. Despite that, there are still risks of identification so it is necessary an extra step to protect data using other techniques such as δ-DOCA, as we are going to explain in this thesis. What is more, there are some risks associated with publishing data without the proper anonymization: •If data is not anonymized, there is a risk that people’s personal information could be accessed and used without their consent. This could lead to identity theft, fraud, or other malicious activities. •It could be used to discriminate against people. For example, if employers have access to non-anonymized data, they could use it to screen out job applicants they do not want to hire. •It could be used to invade people’s privacy. For example, if a person’s health data is not anonymized, it could be used to deny them insurance coverage or raise their premiums. •It could be used to manipulate people. For example, if a person’s political views are not anonymized, they could be targeted with ads and messages that are designed to sway their opinions. •It could be used to blackmail or harass people. For example, if a person’s financial data is not anonymized, someone could use it to threaten to expose their financial situation unless they pay a ransom. 5
Differential Privacy (DP) is a strong notion of privacy that aims to protect the identification of individuals by ensuring that the probability of any person being included in a dataset is not significantly altered by the inclusion or exclusion of any other person. The most common approach to DP is through the use of noise, which is added to the data in order to protect the privacy of individuals while still allowing the data to be useful for analysis. The amount of noise that is added to the data is a function of the privacy parameter, which is typically set by the user. The privacy parameter controls the trade-off between privacy and utility. A higher privacy parameter results in more noise being added to the data, which reduces the utility of the data for analysis, but also results in greater privacy protection. Few recent works have tackled the problem of protecting dynamic data sets with Differencial Privacy guarantees. Essentially, the privacy research community has focused on two distinct scenarios. In the former scenario, all available data or a synopsis thereof (e.g., histograms) are anonymized periodically, although not necessarily at regular time instants. On the contrary, in the latter scenario, (i) data items are not republished in multiple versions, i.e., only new or updated data are protected at a given release time; (ii) time is critical, in the sense that a new or updated data item must be anonymized and published within a predefined, short time frame; and (iii) the order in which the protected data are released matters. We refer to these two scenarios respectively as multiple release and data stream. In the case of data stream, the vast majority of proposals focus on publishing either countbased or aggregated statistics. One of those works is [1], which aims to protect count series (e.g., the daily count of people diagnosed with HIV/AIDS) over individuals continuously. To the best of our knowledge, only [2] has studied the publication of the database itself (rather than statistics derived from it) in a context of data stream. δ-DOCA, as the method is called, adopts a record-masking approach and relies on online clustering to reduce data sensitivity. While this anonymization method has been evaluated using classical distortion metrics like the MSE, it still remains to be proven if the protected data can yield useful results for machine learning (ML) analyses. 1.1 Objectives The overall objective of this thesis is to assess δ-DOCA for this ML analyses and find out whether or not the protected data can still provide useful results; typically, privacy is achieved through data modification, which has an impact on the analyses performed on the protected data. In particular, we are going to develop a framework that evaluates DP anonymization algorithms (specifically, δ-DOCA) using ML. The goal is to see how data modification affects performance in the ML algorithms. 6
To do so, the thesis project relies on an implementation of the δ-DOCA method available in Python, and evaluates it using several datasets and ML tasks. The idea is that it works as a ”black box”: we input a database and the framework outputs some utility metrics for us to see to what extent quality changes due to the data modification. Our work is mainly focused on developing a methodology to assess data protection algorithms and on providing a prototype of an assessment framework that evaluates a specific data protection algorithm, δ-DOCA, that works with categorical data, by using classification tasks. 1.2 Requirements and specifications The resulting framework should be able to: •Read a dataset from a file •Select an anonymization algorithm (δ-DOCA) with a certain privacy parameter and apply it to the dataset •Train a ML model and perform a classification process •Output the utility metrics of both the original and the anonymized datasets •Repeat the same process with different parameter values and compare the outputs 1.3 Methods and procedures This work uses a Python implementation of the δ-DOCA algorithm, which gets a data frame as an input and outputs another data frame with the anonymized rows. The proposed version of δ-DOCA can be applied to a dataset containing only categorical values. For the machine learning part, the scikit-learn library, written in Python too, implements different kinds of models for applying classification, regression or clustering, among other ML operations. The results will be shown in a graphical form using matplotlib and seaborn. 1.4 Deviations from the initial plan The project started as a framework to mainly analyze the utility of data after applying the DOCA algorithm, but later we realized that it would also make sense to apply this analysis to other kinds of anonymization algorithms, such as m-invariance, to obtain the utility metrics of it. We also tried to evaluate the algorithms in terms of privacy, for which we did some research on Membership Inference Attacker (MIA). This was finally discarded as it was not providing any valuable information about the original data after being anonymized. 7
Another initial idea was handling continuous release datasets, that is datasets that get updates on a regular basis and need to be anonymized incrementally. That would need a slightly different implementation of the anonymization algorithms was therefore discarded for simplicity. 8
2 State of the art First of all, we do a research about already existing data protection algorithms and anonymization frameworks that evaluate these algorithms. 2.1 Differential privacy Differential privacy is a type of privacy protection that ensures that individual data points cannot be identified within a dataset to prevent attackers from inferring sensitive information about individual users. This is accomplished by adding random noise to the data so that any one data point cannot be distinguished from the others. It is used in situations where data is collected from a large number of people, such as in census data or medical research and it is necessary to ensure that the individuals’ privacy is protected while still allowing the researchers to collect the data they need. Formally [3], a randomized algorithm Mwith domain N|x|is (ϵ,δ)-differentially private if for all S ⊆ Range(M) and for all x, y ∈N|x|such that ∥x−y∥1≤1: Pr[M(x)∈ S]≤exp(ϵ)Pr[M(y)∈ S] + δ where the probability space is over the coin flips of the mechanism M. If δ= 0, we say that Mis ϵ-differentially private. 2.2 Data protection algorithms When we speak about data protection, there are two types of models we can use: •Syntactic models: focus on the structure of the data and ensure a privacy property on the anonymized data. That is, we impose a privacy guarantee that the data must comply with. Examples of syntactic algorithms are k-anonymity or m-invariance. •Semantic models: focus on the meaning of the data and ensure a privacy property on the mechanism anonymizing the data. In other words, the privacy guarantee is in the algorithm itself. Examples of semantic algorithms are ϵ-differential privacy or δ-DOCA. 2.2.1 δ-DOCA δ-DOCA (Differential Privacy Online Clustering and Anonymization with Domain Bounded by δ) [2] is a semantic algorithm that preserves differential privacy. The strategy it implements is to group the data in clusters through microaggregation, then calculate the centroid of each cluster, add Laplacian noise to it and return this value. The privacy parameter ϵcontrols how much noise is added, with big values of ϵmeaning low noise and hence small modification of the original data, while low values of ϵmean high anonymization and hence less utility. 9
•GradientBoostingClassifier (GB): algorithm that combines many weak models to create a strong one. The strategy is to iteratively create decision trees, each of which tries to correct the errors of the previous tree. The final model is the weighted sum of all the individual decision trees. Since we cannot know beforehand which ones will work better, we can only try all of them. Specifically, the models need to be trained with X train and Y train data. After that, predictions are made using X validation, which can be compared to Y validation to get utility metrics. Before training the models and making predictions, we use cross-validation to assess how the models perform with their training data and how well it will generalize to new data. This way we can detect if there is overfitting, which would mean that the model would return poor results on new datasets. We are going to run this analysis function twice: the first one using the original dataset and test dataset and the second one the anonymized dataset and the same test dataset. This way we will be able to see how the anonymization algorithm affects the performance of all the ML models. In the case we are applying the δ-DOCA algorithm, we can even do more rounds changing the ϵparameter. 3.5 Additional improvements Since the δ-DOCA anonymization process takes some minutes to finish, we have implemented a caching system that saves the resulting dataframe in a csv file inside a tmp folder, so that the next time it is run, the framework will read it from disk instead of repeating the process again. 16
4 Results In this section we present the results obtained by running the framework. We have used the Adult dataset from the UCI Machine Learning Repository, already divided in a train and test subsets. This is a census database that contains demographic information such as age, workclass or education, and a final column ”income ≥$50K/yr”, which is what the framework will try to predict. With the plots we will compare the models performance using the original data and the δ-DOCA protected data with ϵ∈ {500,100,50,10,1}. 4.1 Models cross-validation scores Here we present the cross-validation scores of each model. Figure 5: Box plot of cross-validation scores with original data. Figure 6: Box plot of cross-validation scores applying δ-DOCA algorithm with ϵ= 500. Figure 7: Box plot of cross-validation scores applying δ-DOCA algorithm with ϵ= 100. Figure 8: Box plot of cross-validation scores applying δ-DOCA algorithm with ϵ= 50. 17
Figure 9: Box plot of cross-validation scores applying δ-DOCA algorithm with ϵ= 10. Figure 10: Box plot of cross-validation scores applying δ-DOCA algorithm with ϵ= 1. After validating the models using cross-validation, the resulting scores show that, with anonymized data, all models perform with an accuracy around 0.8 (in the case ϵ= 1, even close to 0.75) on their training data, compared to the original data that performs with accuracies between 0.8 and 0.85. If the models performed with an accuracy close to 1 on their training data, that would mean that these models are overfitted, showing that the data is too complex for the model to fit. Compared with the scores of the original data, results suggest that, when the dataset is anonymized, it is slightly harder for the models to extract relevant features to predict the classification and will perform worse with new, unseen data. This is a sign that the δ-DOCA algorithm is protecting data effectively – ML models are worse at performing predictions with anonymized datasets. 4.2 Utility metrics Here we show the utility metrics described in the previous section. For each model, accuracy, precision, recall and F1 are drawn together in a plot so that it is easier to compare them, while confusion matrices are shown separately afterwards. 18
Figure 11: Utility metrics of the original data. Figure 12: Utility metrics of the anonymized data with ϵ= 500. Figure 13: Utility metrics of the anonymized data with ϵ= 100. Figure 14: Utility metrics of the anonymized data with ϵ= 50. Figure 15: Utility metrics of the anonymized data with ϵ= 10. Figure 16: Utility metrics of the anonymized data with ϵ= 1. 19
Figure 17: Confusion matrices of the original data. 20
Figure 18: Confusion matrices of the anonymized data with ϵ= 500. 21
Figure 19: Confusion matrices of the anonymized data with ϵ= 100. 22
Figure 20: Confusion matrices of the anonymized data with ϵ= 50. 23
Figure 21: Confusion matrices of the anonymized data with ϵ= 10. 24
Figure 22: Confusion matrices of the anonymized data with ϵ= 1. In general, with the utility metrics, we see that the more anonymized the data is (low values of ϵ), the worse the models perform. Let us analyze the differences in utility metrics one by one: •Accuracy: originally between 0.8 and 0.85, decreases a bit up to 0.7 (in model KNN with ϵ= 1). That represents a decrease up to 17.65%. •Precision: originally between 0.65 and 0.76, with anonymization in some models decreases up to 0.38 (model KNN with ϵ= 1) (↓50%) but in others, increases up to 0.81 (model AB with ϵ= 100) (↑24.62%). There is the particular case of ϵ= 1, in which models LR, LDA and NB score a precision of 0. Checking their confusion matrices, we wee that these models are performing particularly poorly, classifying everything as negative. That implies that, per definition, their recall and F1 scores will also be 0. 25