diff --git a/Plots/experiment2_accOct-04-2023,11:21.jpeg b/Plots/experiment2_accOct-04-2023,11:21.jpeg deleted file mode 100644 index 22d8f02..0000000 Binary files a/Plots/experiment2_accOct-04-2023,11:21.jpeg and /dev/null differ diff --git a/Plots/experiment2_accOct-04-2023,11:35.jpeg b/Plots/experiment2_accOct-04-2023,11:35.jpeg deleted file mode 100644 index 22d8f02..0000000 Binary files a/Plots/experiment2_accOct-04-2023,11:35.jpeg and /dev/null differ diff --git a/Plots/experiment2_accOct-04-2023,12:46.jpeg b/Plots/experiment2_accOct-04-2023,12:46.jpeg deleted file mode 100644 index 22d8f02..0000000 Binary files a/Plots/experiment2_accOct-04-2023,12:46.jpeg and /dev/null differ diff --git a/Plots/experiment2_accOct-07-2023,06:04.jpeg b/Plots/experiment2_accOct-07-2023,06:04.jpeg deleted file mode 100644 index 22d8f02..0000000 Binary files a/Plots/experiment2_accOct-07-2023,06:04.jpeg and /dev/null differ diff --git a/Plots/experiment2_accOct-08-2023,16:33.jpeg b/Plots/experiment2_accOct-08-2023,16:33.jpeg deleted file mode 100644 index 22d8f02..0000000 Binary files a/Plots/experiment2_accOct-08-2023,16:33.jpeg and /dev/null differ diff --git a/Plots/experiment2_accOct-09-2023,06:47.jpeg b/Plots/experiment2_accOct-09-2023,06:47.jpeg deleted file mode 100644 index 22d8f02..0000000 Binary files a/Plots/experiment2_accOct-09-2023,06:47.jpeg and /dev/null differ diff --git a/Plots/experiment2_accOct-09-2023,20:51.jpeg b/Plots/experiment2_accOct-09-2023,20:51.jpeg deleted file mode 100644 index 22d8f02..0000000 Binary files a/Plots/experiment2_accOct-09-2023,20:51.jpeg and /dev/null differ diff --git a/Plots/experiment2_accOct-15-2023,20:49.jpeg b/Plots/experiment2_accOct-15-2023,20:49.jpeg new file mode 100644 index 0000000..54fa25d Binary files /dev/null and b/Plots/experiment2_accOct-15-2023,20:49.jpeg differ diff --git a/Plots/experiment2_accOct-16-2023,13:05.jpeg b/Plots/experiment2_accOct-16-2023,13:05.jpeg new file mode 100644 index 0000000..94d0f51 Binary files /dev/null and b/Plots/experiment2_accOct-16-2023,13:05.jpeg differ diff --git a/Plots/experiment2_accOct-16-2023,13:35.jpeg b/Plots/experiment2_accOct-16-2023,13:35.jpeg new file mode 100644 index 0000000..95729cb Binary files /dev/null and b/Plots/experiment2_accOct-16-2023,13:35.jpeg differ diff --git a/Plots/experiment2_accOct-16-2023,13:59.jpeg b/Plots/experiment2_accOct-16-2023,13:59.jpeg new file mode 100644 index 0000000..92eb752 Binary files /dev/null and b/Plots/experiment2_accOct-16-2023,13:59.jpeg differ diff --git a/Plots/experiment2_accOct-04-2023,11:08.jpeg b/Plots/experiment2_accOct-16-2023,14:13.jpeg similarity index 51% rename from Plots/experiment2_accOct-04-2023,11:08.jpeg rename to Plots/experiment2_accOct-16-2023,14:13.jpeg index 22d8f02..b7c4612 100644 Binary files a/Plots/experiment2_accOct-04-2023,11:08.jpeg and b/Plots/experiment2_accOct-16-2023,14:13.jpeg differ diff --git a/Plots/experiment2_accOct-16-2023,14:14.jpeg b/Plots/experiment2_accOct-16-2023,14:14.jpeg new file mode 100644 index 0000000..22c579c Binary files /dev/null and b/Plots/experiment2_accOct-16-2023,14:14.jpeg differ diff --git a/Plots/experiment2_accOct-16-2023,14:26.jpeg b/Plots/experiment2_accOct-16-2023,14:26.jpeg new file mode 100644 index 0000000..dcab216 Binary files /dev/null and b/Plots/experiment2_accOct-16-2023,14:26.jpeg differ diff --git a/Plots/experiment2_precisionOct-04-2023,11:21.jpeg b/Plots/experiment2_accOct-16-2023,14:47.jpeg similarity index 53% rename from Plots/experiment2_precisionOct-04-2023,11:21.jpeg rename to Plots/experiment2_accOct-16-2023,14:47.jpeg index 62300a4..552ded6 100644 Binary files a/Plots/experiment2_precisionOct-04-2023,11:21.jpeg and b/Plots/experiment2_accOct-16-2023,14:47.jpeg differ diff --git a/Plots/experiment2_precisionOct-07-2023,06:05.jpeg b/Plots/experiment2_precisionOct-07-2023,06:05.jpeg deleted file mode 100644 index 62300a4..0000000 Binary files a/Plots/experiment2_precisionOct-07-2023,06:05.jpeg and /dev/null differ diff --git a/Plots/experiment2_precisionOct-08-2023,16:33.jpeg b/Plots/experiment2_precisionOct-08-2023,16:33.jpeg deleted file mode 100644 index 62300a4..0000000 Binary files a/Plots/experiment2_precisionOct-08-2023,16:33.jpeg and /dev/null differ diff --git a/Plots/experiment2_precisionOct-09-2023,06:47.jpeg b/Plots/experiment2_precisionOct-09-2023,06:47.jpeg deleted file mode 100644 index 62300a4..0000000 Binary files a/Plots/experiment2_precisionOct-09-2023,06:47.jpeg and /dev/null differ diff --git a/Plots/experiment2_precisionOct-09-2023,20:51.jpeg b/Plots/experiment2_precisionOct-09-2023,20:51.jpeg deleted file mode 100644 index 62300a4..0000000 Binary files a/Plots/experiment2_precisionOct-09-2023,20:51.jpeg and /dev/null differ diff --git a/Plots/experiment2_precisionOct-15-2023,20:49.jpeg b/Plots/experiment2_precisionOct-15-2023,20:49.jpeg new file mode 100644 index 0000000..255719f Binary files /dev/null and b/Plots/experiment2_precisionOct-15-2023,20:49.jpeg differ diff --git a/Plots/experiment2_precisionOct-16-2023,13:05.jpeg b/Plots/experiment2_precisionOct-16-2023,13:05.jpeg new file mode 100644 index 0000000..7991506 Binary files /dev/null and b/Plots/experiment2_precisionOct-16-2023,13:05.jpeg differ diff --git a/Plots/experiment2_precisionOct-16-2023,13:35.jpeg b/Plots/experiment2_precisionOct-16-2023,13:35.jpeg new file mode 100644 index 0000000..d80937c Binary files /dev/null and b/Plots/experiment2_precisionOct-16-2023,13:35.jpeg differ diff --git a/Plots/experiment2_precisionOct-16-2023,13:59.jpeg b/Plots/experiment2_precisionOct-16-2023,13:59.jpeg new file mode 100644 index 0000000..8e57fc2 Binary files /dev/null and b/Plots/experiment2_precisionOct-16-2023,13:59.jpeg differ diff --git a/Plots/experiment2_precisionOct-04-2023,12:46.jpeg b/Plots/experiment2_precisionOct-16-2023,14:14.jpeg similarity index 52% rename from Plots/experiment2_precisionOct-04-2023,12:46.jpeg rename to Plots/experiment2_precisionOct-16-2023,14:14.jpeg index 62300a4..ff43875 100644 Binary files a/Plots/experiment2_precisionOct-04-2023,12:46.jpeg and b/Plots/experiment2_precisionOct-16-2023,14:14.jpeg differ diff --git a/Plots/experiment2_precisionOct-04-2023,11:35.jpeg b/Plots/experiment2_precisionOct-16-2023,14:26.jpeg similarity index 52% rename from Plots/experiment2_precisionOct-04-2023,11:35.jpeg rename to Plots/experiment2_precisionOct-16-2023,14:26.jpeg index 62300a4..44decbf 100644 Binary files a/Plots/experiment2_precisionOct-04-2023,11:35.jpeg and b/Plots/experiment2_precisionOct-16-2023,14:26.jpeg differ diff --git a/Plots/experiment2_precisionOct-04-2023,11:08.jpeg b/Plots/experiment2_precisionOct-16-2023,14:47.jpeg similarity index 57% rename from Plots/experiment2_precisionOct-04-2023,11:08.jpeg rename to Plots/experiment2_precisionOct-16-2023,14:47.jpeg index 62300a4..a1709af 100644 Binary files a/Plots/experiment2_precisionOct-04-2023,11:08.jpeg and b/Plots/experiment2_precisionOct-16-2023,14:47.jpeg differ diff --git "a/Table/config\\_exp2 central attack.tex" "b/Table/config\\_exp2 central attack.tex" new file mode 100644 index 0000000..f84f000 --- /dev/null +++ "b/Table/config\\_exp2 central attack.tex" @@ -0,0 +1,19 @@ +\begin{table}[h] +\centering +\begin{tabular}{|c|c|} +\hline +parameter & value\\ +\hline +max_depth & 12 \\\hline +objective & binary:logistic \\\hline +tree_method & approx \\\hline +learning_rate & 0.3 \\\hline +n_estimators & 20 \\\hline +gamma & 0 \\\hline +reg_alpha & 0.0 \\\hline +reg_lambda & 1 \\\hline +model & XGBClassifier \\\hline + +\end{tabular}\caption{./Table/config_exp2 central attack} +\label{tab:./Table/config_exp2 central attack} +\end{table} diff --git "a/Table/config\\_exp2 federated attack1.tex" "b/Table/config\\_exp2 federated attack1.tex" new file mode 100644 index 0000000..6cebbf8 --- /dev/null +++ "b/Table/config\\_exp2 federated attack1.tex" @@ -0,0 +1,19 @@ +\begin{table}[h] +\centering +\begin{tabular}{|c|c|} +\hline +parameter & value\\ +\hline +max_depth & 12 \\\hline +objective & binary:logistic \\\hline +tree_method & exact \\\hline +learning_rate & 0.3 \\\hline +n_estimators & 40 \\\hline +gamma & 0 \\\hline +reg_alpha & 0 \\\hline +reg_lambda & 1 \\\hline +model & XGBClassifier \\\hline + +\end{tabular}\caption{./Table/config_exp2 federated attack1} +\label{tab:./Table/config_exp2 federated attack1} +\end{table} diff --git "a/Table/config\\_exp2 federated attack2.tex" "b/Table/config\\_exp2 federated attack2.tex" new file mode 100644 index 0000000..e64f097 --- /dev/null +++ "b/Table/config\\_exp2 federated attack2.tex" @@ -0,0 +1,19 @@ +\begin{table}[h] +\centering +\begin{tabular}{|c|c|} +\hline +parameter & value\\ +\hline +max_depth & 12 \\\hline +objective & binary:logistic \\\hline +tree_method & exact \\\hline +learning_rate & 0.3 \\\hline +n_estimators & 20 \\\hline +gamma & 0 \\\hline +reg_alpha & 0 \\\hline +reg_lambda & 1 \\\hline +model & XGBClassifier \\\hline + +\end{tabular}\caption{./Table/config_exp2 federated attack2} +\label{tab:./Table/config_exp2 federated attack2} +\end{table} diff --git "a/Table/config\\_experiment1\\_attack.tex" "b/Table/config\\_experiment1\\_attack.tex" new file mode 100644 index 0000000..4e11cc1 --- /dev/null +++ "b/Table/config\\_experiment1\\_attack.tex" @@ -0,0 +1,19 @@ +\begin{table}[h] +\centering +\begin{tabular}{|c|c|} +\hline +parameter & value\\ +\hline +max_depth & 12 \\\hline +objective & binary:logistic \\\hline +tree_method & approx \\\hline +learning_rate & 0.3 \\\hline +n_estimators & 20 \\\hline +gamma & 0.5 \\\hline +reg_alpha & 0.0 \\\hline +reg_lambda & 0.1 \\\hline +model & XGBClassifier \\\hline + +\end{tabular}\caption{./Table/config_experiment1_attack} +\label{tab:./Table/config_experiment1_attack} +\end{table} diff --git "a/Table/config\\_experiment1\\_targetandshadow.tex" "b/Table/config\\_experiment1\\_targetandshadow.tex" new file mode 100644 index 0000000..02a8970 --- /dev/null +++ "b/Table/config\\_experiment1\\_targetandshadow.tex" @@ -0,0 +1,17 @@ +\begin{table}[h] +\centering +\begin{tabular}{|c|c|} +\hline +parameter & value\\ +\hline +alpha & 0.0 \\\hline +gamma & 0.5 \\\hline +lam & 0.1 \\\hline +learningrate & 0.3 \\\hline +maxdepth & 8 \\\hline +maxtree & 20 \\\hline +model & FederBoost \\\hline + +\end{tabular}\caption{./Table/config_experiment1_targetandshadow} +\label{tab:./Table/config_experiment1_targetandshadow} +\end{table} diff --git "a/Table/config\\_experiment2\\_targetandshadow.tex" "b/Table/config\\_experiment2\\_targetandshadow.tex" new file mode 100644 index 0000000..3d2aec1 --- /dev/null +++ "b/Table/config\\_experiment2\\_targetandshadow.tex" @@ -0,0 +1,20 @@ +\begin{table}[h] +\centering +\begin{tabular}{|c|c|} +\hline +parameter & value\\ +\hline +alpha & 0.0 \\\hline +gamma & 0.5 \\\hline +lam & 0.1 \\\hline +learningrate & 0.3 \\\hline +maxdepth & 8 \\\hline +maxtree & 20 \\\hline +data_devision & [0.1, 0.9] \\\hline +nBuckets & 100 \\\hline +train_size & 10000 \\\hline +model & FederBoost \\\hline + +\end{tabular}\caption{./Table/config_experiment2_targetandshadow} +\label{tab:./Table/config_experiment2_targetandshadow} +\end{table} diff --git a/Table/config_experiment1_targetandshadow.tex b/Table/config_experiment1_targetandshadow.tex index 60d6456..8f211d9 100644 --- a/Table/config_experiment1_targetandshadow.tex +++ b/Table/config_experiment1_targetandshadow.tex @@ -5,10 +5,10 @@ parameter & value\\ \hline alpha & 0.0 \\\hline -gamma & 0 \\\hline +gamma & 0.5 \\\hline lam & 0.1 \\\hline learningrate & 0.3 \\\hline -maxdepth & 12 \\\hline +maxdepth & 8 \\\hline maxtree & 20 \\\hline model & FederBoost \\\hline diff --git a/Table/experiment_1_alpha.tex b/Table/experiment_1_alpha.tex index 23c519d..28af037 100644 --- a/Table/experiment_1_alpha.tex +++ b/Table/experiment_1_alpha.tex @@ -2,14 +2,14 @@ \begin{tabular}{|c| *{12}{m{1.0cm}|}} \hline\rowcolor{gray!50} \cellcolor{gray!80} alpha & \multicolumn{4}{c|}{healthcare} & \multicolumn{4}{c|}{synthetic-10} & \multicolumn{4}{c|}{synthetic-100}\\\hline -& accuracy attack & recall attack & accuray target & overfitting target & accuracy attack & recall attack & accuray target & overfitting target & accuracy attack & recall attack & accuray target & overfitting target\\\hline -0 & 0.62 & 0.66 & 0.37 & 0.54 & 0.71 & 0.79 & 0.66 & 0.34 & 0.84 & 0.88 & 0.12 & 0.88\\ \hline -0.1 & 0.62 & 0.68 & 0.36 & 0.53 & 0.70 & 0.78 & 0.67 & 0.33 & 0.83 & 0.87 & 0.12 & 0.88\\ \hline -0.25 & 0.61 & 0.65 & 0.38 & 0.50 & 0.71 & 0.78 & 0.68 & 0.32 & 0.84 & 0.85 & 0.13 & 0.87\\ \hline -0.5 & 0.61 & 0.64 & 0.38 & 0.49 & 0.69 & 0.75 & 0.68 & 0.32 & 0.82 & 0.86 & 0.12 & 0.88\\ \hline -0.75 & 0.60 & 0.66 & 0.37 & 0.49 & 0.69 & 0.76 & 0.69 & 0.31 & 0.80 & 0.85 & 0.12 & 0.88\\ \hline -1 & 0.59 & 0.61 & 0.38 & 0.46 & 0.69 & 0.74 & 0.68 & 0.32 & 0.80 & 0.82 & 0.12 & 0.88\\ \hline -10 & 0.52 & 0.54 & 0.39 & 0.14 & 0.53 & 0.54 & 0.63 & 0.24 & 0.48 & 0.55 & 0.07 & 0.12\\ \hline +& accuracy attack & recall attack & accuracy target & overfitting target & accuracy attack & recall attack & accuracy target & overfitting target & accuracy attack & recall attack & accuracy target & overfitting target\\\hline +0 & 0.51 & 0.45 & 0.22 & 0.19 & 0.55 & 0.52 & 0.70 & 0.21 & 0.70 & 0.71 & 0.21 & 0.77\\ \hline +0.1 & 0.50 & 0.53 & 0.19 & 0.17 & 0.54 & 0.48 & 0.70 & 0.21 & 0.69 & 0.70 & 0.21 & 0.76\\ \hline +0.25 & 0.51 & 0.49 & 0.23 & 0.21 & 0.54 & 0.51 & 0.71 & 0.21 & 0.68 & 0.71 & 0.21 & 0.76\\ \hline +0.5 & 0.51 & 0.48 & 0.22 & 0.18 & 0.54 & 0.50 & 0.72 & 0.21 & 0.66 & 0.67 & 0.21 & 0.73\\ \hline +0.75 & 0.51 & 0.53 & 0.23 & 0.15 & 0.54 & 0.51 & 0.71 & 0.20 & 0.64 & 0.67 & 0.20 & 0.73\\ \hline +1 & 0.50 & 0.49 & 0.22 & 0.15 & 0.53 & 0.49 & 0.72 & 0.19 & 0.63 & 0.66 & 0.20 & 0.71\\ \hline +10 & 0.50 & 0.54 & 0.22 & 0.03 & 0.51 & 0.52 & 0.72 & 0.12 & 0.50 & 0.50 & 0.18 & 0.23\\ \hline \end{tabular} \caption{FederBoost-central's attack metrics on alpha.} \label{tab:experiment1_alpha} diff --git a/Table/experiment_1_gamma.tex b/Table/experiment_1_gamma.tex index a3753f7..5dbedce 100644 --- a/Table/experiment_1_gamma.tex +++ b/Table/experiment_1_gamma.tex @@ -2,15 +2,15 @@ \begin{tabular}{|c| *{12}{m{1.0cm}|}} \hline\rowcolor{gray!50} \cellcolor{gray!80} gamma & \multicolumn{4}{c|}{healthcare} & \multicolumn{4}{c|}{synthetic-10} & \multicolumn{4}{c|}{synthetic-100}\\\hline -& accuracy attack & recall attack & accuray target & overfitting target & accuracy attack & recall attack & accuray target & overfitting target & accuracy attack & recall attack & accuray target & overfitting target\\\hline -0 & 0.72 & 0.77 & 0.36 & 0.62 & 0.77 & 0.84 & 0.67 & 0.33 & 0.94 & 0.97 & 0.13 & 0.87\\ \hline -0.1 & 0.71 & 0.76 & 0.39 & 0.59 & 0.76 & 0.83 & 0.66 & 0.34 & 0.94 & 0.96 & 0.13 & 0.87\\ \hline -0.25 & 0.68 & 0.72 & 0.37 & 0.60 & 0.75 & 0.82 & 0.67 & 0.33 & 0.89 & 0.92 & 0.13 & 0.87\\ \hline -0.5 & 0.62 & 0.68 & 0.38 & 0.52 & 0.70 & 0.79 & 0.66 & 0.34 & 0.84 & 0.85 & 0.13 & 0.87\\ \hline -0.75 & 0.59 & 0.65 & 0.36 & 0.50 & 0.68 & 0.75 & 0.68 & 0.32 & 0.80 & 0.84 & 0.12 & 0.87\\ \hline -1 & 0.56 & 0.61 & 0.37 & 0.43 & 0.67 & 0.73 & 0.66 & 0.33 & 0.76 & 0.78 & 0.12 & 0.87\\ \hline -5 & 0.50 & 0.38 & 0.39 & 0.13 & 0.55 & 0.56 & 0.63 & 0.21 & 0.49 & 0.59 & 0.09 & 0.36\\ \hline -10 & 0.50 & 0.49 & 0.38 & 0.05 & 0.52 & 0.55 & 0.58 & 0.15 & 0.50 & 0.76 & 0.07 & 0.13\\ \hline +& accuracy attack & recall attack & accuracy target & overfitting target & accuracy attack & recall attack & accuracy target & overfitting target & accuracy attack & recall attack & accuracy target & overfitting target\\\hline +0 & 0.51 & 0.43 & 0.11 & 0.14 & 0.52 & 0.43 & 0.31 & 0.14 & 0.69 & 0.67 & 0.20 & 0.77\\ \hline +0.1 & 0.51 & 0.35 & 0.11 & 0.13 & 0.52 & 0.44 & 0.39 & 0.17 & 0.70 & 0.70 & 0.20 & 0.76\\ \hline +0.25 & 0.52 & 0.27 & 0.13 & 0.15 & 0.53 & 0.53 & 0.65 & 0.22 & 0.71 & 0.73 & 0.20 & 0.77\\ \hline +0.5 & 0.50 & 0.48 & 0.20 & 0.18 & 0.55 & 0.52 & 0.70 & 0.22 & 0.70 & 0.72 & 0.21 & 0.76\\ \hline +0.75 & 0.51 & 0.48 & 0.26 & 0.23 & 0.55 & 0.56 & 0.74 & 0.19 & 0.69 & 0.72 & 0.21 & 0.76\\ \hline +1 & 0.51 & 0.47 & 0.31 & 0.23 & 0.55 & 0.57 & 0.76 & 0.18 & 0.66 & 0.71 & 0.20 & 0.76\\ \hline +5 & 0.50 & 0.61 & 0.37 & 0.07 & 0.51 & 0.51 & 0.77 & 0.11 & 0.52 & 0.54 & 0.18 & 0.38\\ \hline +10 & 0.51 & 0.51 & 0.39 & 0.05 & 0.52 & 0.50 & 0.75 & 0.08 & 0.50 & 0.49 & 0.15 & 0.20\\ \hline \end{tabular} \caption{FederBoost-central's attack metrics on gamma.} \label{tab:experiment1_gamma} diff --git a/Table/experiment_1_lam.tex b/Table/experiment_1_lam.tex index 56b3d48..8873e69 100644 --- a/Table/experiment_1_lam.tex +++ b/Table/experiment_1_lam.tex @@ -2,14 +2,14 @@ \begin{tabular}{|c| *{12}{m{1.0cm}|}} \hline\rowcolor{gray!50} \cellcolor{gray!80} lam & \multicolumn{4}{c|}{healthcare} & \multicolumn{4}{c|}{synthetic-10} & \multicolumn{4}{c|}{synthetic-100}\\\hline -& accuracy attack & recall attack & accuray target & overfitting target & accuracy attack & recall attack & accuray target & overfitting target & accuracy attack & recall attack & accuray target & overfitting target\\\hline -0 & 0.63 & 0.70 & 0.36 & 0.55 & 0.71 & 0.74 & 0.66 & 0.34 & 0.84 & 0.88 & 0.12 & 0.88\\ \hline -0.1 & 0.62 & 0.63 & 0.36 & 0.55 & 0.72 & 0.77 & 0.66 & 0.33 & 0.85 & 0.90 & 0.13 & 0.87\\ \hline -0.25 & 0.62 & 0.70 & 0.37 & 0.53 & 0.70 & 0.76 & 0.67 & 0.33 & 0.84 & 0.87 & 0.13 & 0.87\\ \hline -0.5 & 0.60 & 0.66 & 0.37 & 0.52 & 0.71 & 0.78 & 0.67 & 0.33 & 0.84 & 0.89 & 0.12 & 0.88\\ \hline -0.75 & 0.62 & 0.71 & 0.37 & 0.51 & 0.70 & 0.78 & 0.68 & 0.32 & 0.84 & 0.85 & 0.13 & 0.86\\ \hline -1 & 0.60 & 0.71 & 0.39 & 0.48 & 0.68 & 0.73 & 0.67 & 0.32 & 0.83 & 0.85 & 0.14 & 0.86\\ \hline -10 & 0.55 & 0.63 & 0.38 & 0.35 & 0.62 & 0.66 & 0.69 & 0.28 & 0.65 & 0.68 & 0.13 & 0.71\\ \hline +& accuracy attack & recall attack & accuracy target & overfitting target & accuracy attack & recall attack & accuracy target & overfitting target & accuracy attack & recall attack & accuracy target & overfitting target\\\hline +0 & 0.52 & 0.46 & 0.22 & 0.19 & 0.54 & 0.52 & 0.70 & 0.21 & 0.70 & 0.74 & 0.20 & 0.78\\ \hline +0.1 & 0.51 & 0.48 & 0.21 & 0.19 & 0.55 & 0.55 & 0.72 & 0.22 & 0.70 & 0.71 & 0.20 & 0.77\\ \hline +0.25 & 0.51 & 0.46 & 0.22 & 0.19 & 0.55 & 0.51 & 0.71 & 0.21 & 0.69 & 0.71 & 0.22 & 0.75\\ \hline +0.5 & 0.51 & 0.44 & 0.24 & 0.18 & 0.54 & 0.50 & 0.73 & 0.20 & 0.68 & 0.67 & 0.22 & 0.72\\ \hline +0.75 & 0.51 & 0.52 & 0.25 & 0.19 & 0.55 & 0.56 & 0.74 & 0.20 & 0.67 & 0.63 & 0.22 & 0.70\\ \hline +1 & 0.51 & 0.52 & 0.23 & 0.18 & 0.54 & 0.56 & 0.73 & 0.19 & 0.67 & 0.66 & 0.23 & 0.69\\ \hline +10 & 0.50 & 0.55 & 0.37 & 0.11 & 0.53 & 0.55 & 0.76 & 0.13 & 0.56 & 0.57 & 0.24 & 0.43\\ \hline \end{tabular} \caption{FederBoost-central's attack metrics on lam.} \label{tab:experiment1_lam} diff --git a/Table/experiment_1_learning_rate.tex b/Table/experiment_1_learning_rate.tex index 489c179..f635877 100644 --- a/Table/experiment_1_learning_rate.tex +++ b/Table/experiment_1_learning_rate.tex @@ -2,12 +2,12 @@ \begin{tabular}{|c| *{12}{m{1.0cm}|}} \hline\rowcolor{gray!50} \cellcolor{gray!80} learning_rate & \multicolumn{4}{c|}{healthcare} & \multicolumn{4}{c|}{synthetic-10} & \multicolumn{4}{c|}{synthetic-100}\\\hline -& accuracy attack & recall attack & accuray target & overfitting target & accuracy attack & recall attack & accuray target & overfitting target & accuracy attack & recall attack & accuray target & overfitting target\\\hline -0.1 & 0.61 & 0.67 & 0.38 & 0.47 & 0.69 & 0.75 & 0.64 & 0.35 & 0.81 & 0.85 & 0.14 & 0.85\\ \hline -0.25 & 0.62 & 0.67 & 0.38 & 0.51 & 0.71 & 0.77 & 0.67 & 0.33 & 0.86 & 0.88 & 0.12 & 0.88\\ \hline -0.5 & 0.58 & 0.61 & 0.37 & 0.52 & 0.69 & 0.74 & 0.65 & 0.35 & 0.79 & 0.83 & 0.12 & 0.88\\ \hline -0.75 & 0.56 & 0.60 & 0.35 & 0.56 & 0.66 & 0.71 & 0.64 & 0.36 & 0.70 & 0.79 & 0.09 & 0.91\\ \hline -1 & 0.56 & 0.53 & 0.32 & 0.60 & 0.64 & 0.68 & 0.59 & 0.41 & 0.62 & 0.68 & 0.09 & 0.91\\ \hline +& accuracy attack & recall attack & accuracy target & overfitting target & accuracy attack & recall attack & accuracy target & overfitting target & accuracy attack & recall attack & accuracy target & overfitting target\\\hline +0.1 & 0.50 & 0.43 & 0.18 & 0.11 & 0.51 & 0.48 & 0.58 & 0.18 & 0.60 & 0.60 & 0.20 & 0.63\\ \hline +0.25 & 0.51 & 0.40 & 0.21 & 0.16 & 0.55 & 0.49 & 0.70 & 0.20 & 0.68 & 0.68 & 0.20 & 0.74\\ \hline +0.5 & 0.52 & 0.50 & 0.20 & 0.25 & 0.57 & 0.55 & 0.75 & 0.22 & 0.68 & 0.74 & 0.19 & 0.81\\ \hline +0.75 & 0.53 & 0.53 & 0.26 & 0.29 & 0.59 & 0.61 & 0.77 & 0.21 & 0.61 & 0.64 & 0.15 & 0.85\\ \hline +1 & 0.53 & 0.45 & 0.24 & 0.34 & 0.61 & 0.67 & 0.79 & 0.21 & 0.50 & 1.00 & 0.02 & 0.00\\ \hline \end{tabular} \caption{FederBoost-central's attack metrics on learning_rate.} \label{tab:experiment1_learning_rate} diff --git a/Table/experiment_1_max_depth.tex b/Table/experiment_1_max_depth.tex index ad69d94..70c9b7a 100644 --- a/Table/experiment_1_max_depth.tex +++ b/Table/experiment_1_max_depth.tex @@ -2,11 +2,11 @@ \begin{tabular}{|c| *{12}{m{1.0cm}|}} \hline\rowcolor{gray!50} \cellcolor{gray!80} max_depth & \multicolumn{4}{c|}{healthcare} & \multicolumn{4}{c|}{synthetic-10} & \multicolumn{4}{c|}{synthetic-100}\\\hline -& accuracy attack & recall attack & accuray target & overfitting target & accuracy attack & recall attack & accuray target & overfitting target & accuracy attack & recall attack & accuray target & overfitting target\\\hline -5 & 0.53 & 0.56 & 0.39 & 0.34 & 0.63 & 0.66 & 0.67 & 0.30 & 0.82 & 0.84 & 0.12 & 0.88\\ \hline -8 & 0.62 & 0.70 & 0.36 & 0.54 & 0.72 & 0.79 & 0.67 & 0.33 & 0.84 & 0.90 & 0.13 & 0.87\\ \hline -12 & 0.69 & 0.72 & 0.35 & 0.62 & 0.74 & 0.81 & 0.67 & 0.33 & 0.85 & 0.86 & 0.12 & 0.88\\ \hline -15 & 0.70 & 0.74 & 0.36 & 0.61 & 0.74 & 0.80 & 0.67 & 0.33 & 0.85 & 0.87 & 0.12 & 0.88\\ \hline +& accuracy attack & recall attack & accuracy target & overfitting target & accuracy attack & recall attack & accuracy target & overfitting target & accuracy attack & recall attack & accuracy target & overfitting target\\\hline +5 & 0.50 & 0.43 & 0.11 & 0.01 & 0.50 & 0.34 & 0.10 & -0.00 & 0.50 & 0.54 & 0.12 & 0.25\\ \hline +8 & 0.51 & 0.41 & 0.20 & 0.19 & 0.55 & 0.52 & 0.71 & 0.21 & 0.70 & 0.72 & 0.21 & 0.77\\ \hline +12 & 0.67 & 0.66 & 0.34 & 0.60 & 0.65 & 0.71 & 0.80 & 0.20 & 0.78 & 0.86 & 0.22 & 0.78\\ \hline +15 & 0.73 & 0.75 & 0.36 & 0.62 & 0.66 & 0.72 & 0.81 & 0.19 & 0.78 & 0.85 & 0.22 & 0.78\\ \hline \end{tabular} \caption{FederBoost-central's attack metrics on max_depth.} \label{tab:experiment1_max_depth} diff --git a/Table/experiment_1_max_tree.tex b/Table/experiment_1_max_tree.tex index 0687c09..cbaccef 100644 --- a/Table/experiment_1_max_tree.tex +++ b/Table/experiment_1_max_tree.tex @@ -2,14 +2,14 @@ \begin{tabular}{|c| *{12}{m{1.0cm}|}} \hline\rowcolor{gray!50} \cellcolor{gray!80} max_tree & \multicolumn{4}{c|}{healthcare} & \multicolumn{4}{c|}{synthetic-10} & \multicolumn{4}{c|}{synthetic-100}\\\hline -& accuracy attack & recall attack & accuray target & overfitting target & accuracy attack & recall attack & accuray target & overfitting target & accuracy attack & recall attack & accuray target & overfitting target\\\hline -5 & 0.56 & 0.60 & 0.35 & 0.43 & 0.64 & 0.67 & 0.61 & 0.36 & 0.66 & 0.72 & 0.10 & 0.82\\ \hline -10 & 0.59 & 0.66 & 0.36 & 0.52 & 0.68 & 0.74 & 0.66 & 0.34 & 0.82 & 0.86 & 0.12 & 0.88\\ \hline -20 & 0.62 & 0.71 & 0.37 & 0.54 & 0.72 & 0.78 & 0.67 & 0.33 & 0.84 & 0.84 & 0.12 & 0.88\\ \hline -30 & 0.64 & 0.62 & 0.37 & 0.55 & 0.71 & 0.79 & 0.67 & 0.33 & 0.84 & 0.90 & 0.12 & 0.88\\ \hline -50 & 0.63 & 0.59 & 0.37 & 0.53 & 0.71 & 0.77 & 0.66 & 0.34 & 0.84 & 0.86 & 0.13 & 0.87\\ \hline -100 & 0.62 & 0.60 & 0.37 & 0.52 & 0.70 & 0.78 & 0.67 & 0.32 & 0.84 & 0.87 & 0.12 & 0.88\\ \hline -150 & 0.63 & 0.61 & 0.36 & 0.55 & 0.70 & 0.75 & 0.66 & 0.34 & 0.85 & 0.86 & 0.12 & 0.88\\ \hline +& accuracy attack & recall attack & accuracy target & overfitting target & accuracy attack & recall attack & accuracy target & overfitting target & accuracy attack & recall attack & accuracy target & overfitting target\\\hline +5 & 0.50 & 0.50 & 0.17 & 0.09 & 0.50 & 0.48 & 0.52 & 0.14 & 0.53 & 0.56 & 0.17 & 0.45\\ \hline +10 & 0.50 & 0.49 & 0.17 & 0.14 & 0.52 & 0.47 & 0.61 & 0.20 & 0.59 & 0.60 & 0.18 & 0.66\\ \hline +20 & 0.51 & 0.49 & 0.22 & 0.19 & 0.55 & 0.49 & 0.69 & 0.21 & 0.70 & 0.71 & 0.21 & 0.77\\ \hline +30 & 0.52 & 0.44 & 0.20 & 0.23 & 0.57 & 0.54 & 0.73 & 0.22 & 0.75 & 0.80 & 0.22 & 0.77\\ \hline +50 & 0.53 & 0.49 & 0.23 & 0.26 & 0.60 & 0.59 & 0.78 & 0.20 & 0.76 & 0.84 & 0.22 & 0.78\\ \hline +100 & 0.54 & 0.39 & 0.25 & 0.31 & 0.62 & 0.67 & 0.81 & 0.18 & 0.77 & 0.83 & 0.22 & 0.78\\ \hline +150 & 0.55 & 0.38 & 0.27 & 0.35 & 0.63 & 0.66 & 0.82 & 0.18 & 0.76 & 0.82 & 0.22 & 0.78\\ \hline \end{tabular} \caption{FederBoost-central's attack metrics on max_tree.} \label{tab:experiment1_max_tree} diff --git a/Table/experiment_1_nBuckets.tex b/Table/experiment_1_nBuckets.tex new file mode 100644 index 0000000..fde2843 --- /dev/null +++ b/Table/experiment_1_nBuckets.tex @@ -0,0 +1,14 @@ +\begin{table*}[]\centering +\begin{tabular}{|c| *{12}{m{1.0cm}|}} +\hline\rowcolor{gray!50} +\cellcolor{gray!80} nBuckets & \multicolumn{4}{c|}{healthcare} & \multicolumn{4}{c|}{synthetic-10} & \multicolumn{4}{c|}{synthetic-100}\\\hline +& accuracy attack & recall attack & accuracy target & overfitting target & accuracy attack & recall attack & accuracy target & overfitting target & accuracy attack & recall attack & accuracy target & overfitting target\\\hline +10 & 0.50 & 0.51 & 0.21 & 0.17 & 0.53 & 0.53 & 0.72 & 0.17 & 0.62 & 0.62 & 0.20 & 0.72\\ \hline +20 & 0.50 & 0.48 & 0.21 & 0.18 & 0.53 & 0.55 & 0.73 & 0.19 & 0.66 & 0.67 & 0.21 & 0.75\\ \hline +50 & 0.51 & 0.44 & 0.22 & 0.19 & 0.54 & 0.53 & 0.73 & 0.20 & 0.69 & 0.71 & 0.21 & 0.76\\ \hline +100 & 0.51 & 0.42 & 0.23 & 0.19 & 0.55 & 0.52 & 0.70 & 0.21 & 0.70 & 0.74 & 0.21 & 0.77\\ \hline +1000 & 0.51 & 0.44 & 0.21 & 0.19 & 0.55 & 0.54 & 0.69 & 0.23 & 0.71 & 0.73 & 0.20 & 0.78\\ \hline +\end{tabular} +\caption{FederBoost-central's attack metrics on nBuckets.} +\label{tab:experiment1_nBuckets} +\end{table*} diff --git a/Table/experiment_1_train_size.tex b/Table/experiment_1_train_size.tex new file mode 100644 index 0000000..28cc5c2 --- /dev/null +++ b/Table/experiment_1_train_size.tex @@ -0,0 +1,13 @@ +\begin{table*}[]\centering +\begin{tabular}{|c| *{12}{m{1.0cm}|}} +\hline\rowcolor{gray!50} +\cellcolor{gray!80} train_size & \multicolumn{4}{c|}{healthcare} & \multicolumn{4}{c|}{synthetic-10} & \multicolumn{4}{c|}{synthetic-100}\\\hline +& accuracy attack & recall attack & accuracy target & overfitting target & accuracy attack & recall attack & accuracy target & overfitting target & accuracy attack & recall attack & accuracy target & overfitting target\\\hline +1000 & 0.67 & 0.71 & 0.31 & 0.64 & 0.72 & 0.76 & 0.58 & 0.42 & 0.85 & 0.90 & 0.07 & 0.93\\ \hline +2000 & 0.59 & 0.66 & 0.31 & 0.60 & 0.69 & 0.70 & 0.61 & 0.39 & 0.84 & 0.89 & 0.12 & 0.88\\ \hline +5000 & 0.54 & 0.54 & 0.28 & 0.34 & 0.60 & 0.57 & 0.69 & 0.28 & 0.77 & 0.80 & 0.19 & 0.80\\ \hline +10000 & 0.51 & 0.43 & 0.23 & 0.19 & 0.54 & 0.52 & 0.72 & 0.20 & 0.70 & 0.72 & 0.20 & 0.77\\ \hline +\end{tabular} +\caption{FederBoost-central's attack metrics on train_size.} +\label{tab:experiment1_train_size} +\end{table*} diff --git a/environment.txt b/environment.txt new file mode 100644 index 0000000..7ab8731 --- /dev/null +++ b/environment.txt @@ -0,0 +1,173 @@ +# This file may be used to create an environment using: +# $ conda create --name --file +# platform: linux-64 +@EXPLICIT +https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2 +https://repo.anaconda.com/pkgs/main/linux-64/_py-xgboost-mutex-2.0-cpu_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/blas-1.0-mkl.conda +https://repo.anaconda.com/pkgs/main/linux-64/ca-certificates-2023.08.22-h06a4308_0.conda +https://repo.anaconda.com/pkgs/main/noarch/font-ttf-dejavu-sans-mono-2.37-hd3eb1b0_0.conda +https://repo.anaconda.com/pkgs/main/noarch/font-ttf-inconsolata-2.001-hcb22688_0.conda +https://repo.anaconda.com/pkgs/main/noarch/font-ttf-source-code-pro-2.030-hd3eb1b0_0.conda +https://repo.anaconda.com/pkgs/main/noarch/font-ttf-ubuntu-0.83-h8b1ccd4_0.conda +https://conda.anaconda.org/conda-forge/noarch/kernel-headers_linux-64-2.6.32-he073ed8_15.tar.bz2 +https://conda.anaconda.org/conda-forge/linux-64/ld_impl_linux-64-2.40-h41732ed_0.conda +https://conda.anaconda.org/conda-forge/linux-64/libgcc-devel_linux-64-13.1.0-he3cc6c4_0.conda +https://conda.anaconda.org/conda-forge/linux-64/libgfortran5-13.1.0-h15d22d2_0.conda +https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-devel_linux-64-13.1.0-he3cc6c4_0.conda +https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-ng-13.1.0-hfd8a6a1_0.conda +https://conda.anaconda.org/conda-forge/linux-64/mpi-1.0-openmpi.tar.bz2 +https://repo.anaconda.com/pkgs/main/linux-64/poppler-data-0.4.11-h06a4308_1.conda +https://conda.anaconda.org/conda-forge/noarch/rust-std-x86_64-unknown-linux-gnu-1.73.0-hc1431ca_0.conda +https://repo.anaconda.com/pkgs/main/noarch/fonts-anaconda-1-h8fa9717_0.conda +https://conda.anaconda.org/conda-forge/linux-64/libgfortran-ng-13.1.0-h69a702a_0.conda +https://conda.anaconda.org/conda-forge/linux-64/libgomp-13.1.0-he5830b7_0.conda +https://conda.anaconda.org/conda-forge/noarch/sysroot_linux-64-2.12-he073ed8_15.tar.bz2 +https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-2_gnu.tar.bz2 +https://conda.anaconda.org/conda-forge/linux-64/binutils_impl_linux-64-2.40-hf600244_0.conda +https://repo.anaconda.com/pkgs/main/noarch/fonts-conda-ecosystem-1-hd3eb1b0_0.conda +https://conda.anaconda.org/conda-forge/linux-64/binutils_linux-64-2.40-hbdbef99_0.conda +https://conda.anaconda.org/conda-forge/linux-64/libgcc-ng-13.1.0-he5830b7_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/libxgboost-1.7.3-h6a678d5_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/bzip2-1.0.8-h7b6447c_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/c-ares-1.19.1-h5eee18b_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/expat-2.4.9-h6a678d5_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/fribidi-1.0.10-h7b6447c_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/giflib-5.2.1-h5eee18b_3.conda +https://repo.anaconda.com/pkgs/main/linux-64/graphite2-1.3.14-h295c915_1.conda +https://repo.anaconda.com/pkgs/main/linux-64/icu-58.2-he6710b0_3.conda +https://repo.anaconda.com/pkgs/main/linux-64/jpeg-9e-h5eee18b_1.conda +https://repo.anaconda.com/pkgs/main/linux-64/lerc-3.0-h295c915_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/libbrotlicommon-1.0.9-h5eee18b_7.conda +https://repo.anaconda.com/pkgs/main/linux-64/libdeflate-1.17-h5eee18b_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/libev-4.33-h7f8727e_1.conda +https://repo.anaconda.com/pkgs/main/linux-64/libffi-3.4.4-h6a678d5_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/libiconv-1.16-h7f8727e_2.conda +https://conda.anaconda.org/conda-forge/linux-64/libsanitizer-13.1.0-hfd8a6a1_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/libtool-2.4.6-h6a678d5_1009.conda +https://repo.anaconda.com/pkgs/main/linux-64/libuuid-1.41.5-h5eee18b_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/libwebp-base-1.2.4-h5eee18b_1.conda +https://repo.anaconda.com/pkgs/main/linux-64/libxcb-1.15-h7f8727e_0.conda +https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.2.13-hd590300_5.conda +https://repo.anaconda.com/pkgs/main/linux-64/lz4-c-1.9.4-h6a678d5_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/ncurses-6.4-h6a678d5_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/ninja-base-1.10.2-hd09550d_5.conda +https://repo.anaconda.com/pkgs/main/linux-64/nspr-4.35-h6a678d5_0.conda +https://conda.anaconda.org/conda-forge/linux-64/openssl-3.1.3-hd590300_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/pcre-8.45-h295c915_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/pixman-0.40.0-h7f8727e_1.conda +https://repo.anaconda.com/pkgs/main/linux-64/tbb-2021.8.0-hdb19cb5_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/xz-5.4.2-h5eee18b_0.conda +https://conda.anaconda.org/conda-forge/linux-64/gcc_impl_linux-64-13.1.0-hc4be1a9_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/libbrotlidec-1.0.9-h5eee18b_7.conda +https://repo.anaconda.com/pkgs/main/linux-64/libbrotlienc-1.0.9-h5eee18b_7.conda +https://repo.anaconda.com/pkgs/main/linux-64/libedit-3.1.20221030-h5eee18b_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/libevent-2.1.12-hdbd6064_1.conda +https://repo.anaconda.com/pkgs/main/linux-64/libssh2-1.10.0-hdbd6064_2.conda +https://conda.anaconda.org/conda-forge/linux-64/nano-7.2-h8228510_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/readline-8.2-h5eee18b_0.conda +https://conda.anaconda.org/conda-forge/linux-64/zlib-1.2.13-hd590300_5.conda +https://repo.anaconda.com/pkgs/main/linux-64/brotli-bin-1.0.9-h5eee18b_7.conda +https://conda.anaconda.org/conda-forge/linux-64/gcc-13.1.0-h8e92de4_0.conda +https://conda.anaconda.org/conda-forge/linux-64/gcc_linux-64-13.1.0-hd2d1137_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/glib-2.69.1-he621ea3_2.conda +https://conda.anaconda.org/conda-forge/linux-64/gxx_impl_linux-64-13.1.0-hc4be1a9_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/intel-openmp-2023.1.0-hdb19cb5_46305.conda +https://repo.anaconda.com/pkgs/main/linux-64/krb5-1.20.1-h143b758_1.conda +https://repo.anaconda.com/pkgs/main/linux-64/libllvm10-10.0.1-hbcb73fb_5.conda +https://repo.anaconda.com/pkgs/main/linux-64/libnghttp2-1.52.0-h2d74bed_1.conda +https://repo.anaconda.com/pkgs/main/linux-64/libpng-1.6.39-h5eee18b_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/libxml2-2.9.14-h74e7548_0.conda +https://conda.anaconda.org/conda-forge/linux-64/openmpi-4.1.5-h414af15_101.conda +https://conda.anaconda.org/conda-forge/linux-64/rust-1.73.0-h70c747d_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/sqlite-3.41.2-h5eee18b_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/tk-8.6.12-h1ccaba5_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/zstd-1.5.5-hc292b87_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/brotli-1.0.9-h5eee18b_7.conda +https://repo.anaconda.com/pkgs/main/linux-64/dbus-1.13.18-hb2f20db_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/freetype-2.12.1-h4a9f257_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/gstreamer-1.14.1-h5eee18b_1.conda +https://repo.anaconda.com/pkgs/main/linux-64/gts-0.7.6-hb67d8dd_3.conda +https://conda.anaconda.org/conda-forge/linux-64/gxx_linux-64-13.1.0-h5006d2a_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/libboost-1.73.0-h28710b8_12.conda +https://repo.anaconda.com/pkgs/main/linux-64/libclang-10.0.1-default_hb85057a_2.conda +https://repo.anaconda.com/pkgs/main/linux-64/libcurl-8.2.1-h251f7ec_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/libpq-12.15-hdbd6064_1.conda +https://repo.anaconda.com/pkgs/main/linux-64/libtiff-4.5.0-h6a678d5_2.conda +https://repo.anaconda.com/pkgs/main/linux-64/libxkbcommon-1.0.1-hfa300c1_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/libxslt-1.1.35-h4e12654_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/mkl-2023.1.0-h6d00ec8_46342.conda +https://repo.anaconda.com/pkgs/main/linux-64/nss-3.89.1-h6a678d5_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/python-3.8.16-h955ad1f_4.conda +https://repo.anaconda.com/pkgs/main/noarch/appdirs-1.4.4-pyhd3eb1b0_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/boost-cpp-1.73.0-h7f8727e_12.conda +https://conda.anaconda.org/conda-forge/noarch/certifi-2023.7.22-pyhd8ed1ab_0.conda +https://repo.anaconda.com/pkgs/main/noarch/charset-normalizer-2.0.4-pyhd3eb1b0_0.conda +https://repo.anaconda.com/pkgs/main/noarch/cycler-0.11.0-pyhd3eb1b0_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/fontconfig-2.14.1-h52c9d5c_1.conda +https://repo.anaconda.com/pkgs/main/linux-64/gdk-pixbuf-2.42.10-h5eee18b_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/gobject-introspection-1.72.0-py38hbb6d50b_2.conda +https://repo.anaconda.com/pkgs/main/linux-64/gst-plugins-base-1.14.1-h6a678d5_1.conda +https://repo.anaconda.com/pkgs/main/linux-64/idna-3.4-py38h06a4308_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/joblib-1.2.0-py38h06a4308_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/kiwisolver-1.4.2-py38h295c915_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/lcms2-2.12-h3be6417_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/libwebp-1.2.4-h11a3e52_1.conda +https://repo.anaconda.com/pkgs/main/linux-64/mkl-service-2.4.0-py38h5eee18b_1.conda +https://repo.anaconda.com/pkgs/main/noarch/munkres-1.1.4-py_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/ninja-1.10.2-h06a4308_5.conda +https://repo.anaconda.com/pkgs/main/linux-64/openjpeg-2.4.0-h3ad879b_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/ply-3.11-py38_0.conda +https://repo.anaconda.com/pkgs/main/noarch/pycparser-2.21-pyhd3eb1b0_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/pyparsing-3.0.9-py38h06a4308_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/pysocks-1.7.1-py38h06a4308_0.conda +https://conda.anaconda.org/conda-forge/linux-64/python_abi-3.8-2_cp38.tar.bz2 +https://repo.anaconda.com/pkgs/main/linux-64/pytz-2022.1-py38h06a4308_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/setuptools-67.8.0-py38h06a4308_0.conda +https://repo.anaconda.com/pkgs/main/noarch/six-1.16.0-pyhd3eb1b0_1.conda +https://repo.anaconda.com/pkgs/main/noarch/threadpoolctl-2.2.0-pyh0d69192_0.conda +https://repo.anaconda.com/pkgs/main/noarch/toml-0.10.2-pyhd3eb1b0_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/tornado-6.2-py38h5eee18b_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/wheel-0.38.4-py38h06a4308_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/atk-1.0-2.36.0-ha1a6a79_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/cairo-1.16.0-hb05425b_5.conda +https://repo.anaconda.com/pkgs/main/linux-64/cffi-1.15.1-py38h5eee18b_3.conda +https://repo.anaconda.com/pkgs/main/noarch/fonttools-4.25.0-pyhd3eb1b0_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/libgd-2.3.3-h6a678d5_3.conda +https://conda.anaconda.org/conda-forge/linux-64/mpi4py-3.1.4-py38h64caa1c_0.tar.bz2 +https://repo.anaconda.com/pkgs/main/linux-64/numpy-base-1.24.3-py38h060ed82_1.conda +https://repo.anaconda.com/pkgs/main/noarch/packaging-21.3-pyhd3eb1b0_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/pillow-9.4.0-py38h6a678d5_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/pip-23.1.2-py38h06a4308_0.conda +https://repo.anaconda.com/pkgs/main/noarch/python-dateutil-2.8.2-pyhd3eb1b0_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/qt-main-5.15.2-h327a75a_7.conda +https://repo.anaconda.com/pkgs/main/linux-64/brotlipy-0.7.0-py38h27cfd23_1003.conda +https://repo.anaconda.com/pkgs/main/linux-64/cryptography-39.0.1-py38h9ce1e76_2.conda +https://repo.anaconda.com/pkgs/main/linux-64/harfbuzz-4.3.0-hf52aaf7_1.conda +https://repo.anaconda.com/pkgs/main/linux-64/poppler-22.12.0-h9614445_1.conda +https://repo.anaconda.com/pkgs/main/linux-64/qt-webengine-5.15.9-hd2b0992_4.conda +https://repo.anaconda.com/pkgs/main/linux-64/sip-6.6.2-py38h6a678d5_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/pango-1.50.7-h05da053_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/pyopenssl-23.0.0-py38h06a4308_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/pyqt5-sip-12.11.0-py38h6a678d5_1.conda +https://repo.anaconda.com/pkgs/main/linux-64/qtwebkit-5.212-h4eab89a_4.conda +https://repo.anaconda.com/pkgs/main/linux-64/gtk2-2.24.33-h73c1081_2.conda +https://repo.anaconda.com/pkgs/main/linux-64/librsvg-2.54.4-h36cc946_2.conda +https://repo.anaconda.com/pkgs/main/linux-64/pyqt-5.15.7-py38h6a678d5_1.conda +https://repo.anaconda.com/pkgs/main/linux-64/urllib3-1.26.16-py38h06a4308_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/graphviz-2.50.0-h1b29801_1.conda +https://repo.anaconda.com/pkgs/main/linux-64/requests-2.29.0-py38h06a4308_0.conda +https://repo.anaconda.com/pkgs/main/noarch/pooch-1.4.0-pyhd3eb1b0_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/bottleneck-1.3.5-py38h7deecbd_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/matplotlib-3.5.1-py38h06a4308_1.conda +https://repo.anaconda.com/pkgs/main/linux-64/matplotlib-base-3.5.1-py38ha18d171_1.conda +https://repo.anaconda.com/pkgs/main/linux-64/mkl_fft-1.3.6-py38h417a72b_1.conda +https://repo.anaconda.com/pkgs/main/linux-64/mkl_random-1.2.2-py38h417a72b_1.conda +https://repo.anaconda.com/pkgs/main/linux-64/numpy-1.24.3-py38hf6e8229_1.conda +https://repo.anaconda.com/pkgs/main/linux-64/numexpr-2.8.4-py38hc78ab66_1.conda +https://repo.anaconda.com/pkgs/main/linux-64/scipy-1.10.1-py38hf6e8229_1.conda +https://repo.anaconda.com/pkgs/main/linux-64/pandas-1.4.2-py38h295c915_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/scikit-learn-1.2.2-py38h6a678d5_1.conda +https://conda.anaconda.org/conda-forge/noarch/imbalanced-learn-0.11.0-pyhd8ed1ab_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/py-xgboost-1.7.3-py38h06a4308_0.conda +https://repo.anaconda.com/pkgs/main/linux-64/xgboost-1.7.3-py38h06a4308_0.conda diff --git a/environment.yml b/environment.yml new file mode 100644 index 0000000..0a9fab1 --- /dev/null +++ b/environment.yml @@ -0,0 +1,259 @@ +name: fedxgboost_mpi +channels: + - conda-forge + - defaults +dependencies: + - _libgcc_mutex=0.1=conda_forge + - _openmp_mutex=4.5=2_gnu + - _py-xgboost-mutex=2.0=cpu_0 + - appdirs=1.4.4=pyhd3eb1b0_0 + - atk-1.0=2.36.0=ha1a6a79_0 + - binutils_impl_linux-64=2.40=hf600244_0 + - binutils_linux-64=2.40=hbdbef99_0 + - blas=1.0=mkl + - boost-cpp=1.73.0=h7f8727e_12 + - bottleneck=1.3.5=py38h7deecbd_0 + - brotli=1.0.9=h5eee18b_7 + - brotli-bin=1.0.9=h5eee18b_7 + - brotlipy=0.7.0=py38h27cfd23_1003 + - bzip2=1.0.8=h7b6447c_0 + - c-ares=1.19.1=h5eee18b_0 + - ca-certificates=2023.08.22=h06a4308_0 + - cairo=1.16.0=hb05425b_5 + - certifi=2023.7.22=pyhd8ed1ab_0 + - cffi=1.15.1=py38h5eee18b_3 + - charset-normalizer=2.0.4=pyhd3eb1b0_0 + - cryptography=39.0.1=py38h9ce1e76_2 + - cycler=0.11.0=pyhd3eb1b0_0 + - dbus=1.13.18=hb2f20db_0 + - expat=2.4.9=h6a678d5_0 + - font-ttf-dejavu-sans-mono=2.37=hd3eb1b0_0 + - font-ttf-inconsolata=2.001=hcb22688_0 + - font-ttf-source-code-pro=2.030=hd3eb1b0_0 + - font-ttf-ubuntu=0.83=h8b1ccd4_0 + - fontconfig=2.14.1=h52c9d5c_1 + - fonts-anaconda=1=h8fa9717_0 + - fonts-conda-ecosystem=1=hd3eb1b0_0 + - fonttools=4.25.0=pyhd3eb1b0_0 + - freetype=2.12.1=h4a9f257_0 + - fribidi=1.0.10=h7b6447c_0 + - gcc=13.1.0=h8e92de4_0 + - gcc_impl_linux-64=13.1.0=hc4be1a9_0 + - gcc_linux-64=13.1.0=hd2d1137_0 + - gdk-pixbuf=2.42.10=h5eee18b_0 + - giflib=5.2.1=h5eee18b_3 + - glib=2.69.1=he621ea3_2 + - gobject-introspection=1.72.0=py38hbb6d50b_2 + - graphite2=1.3.14=h295c915_1 + - graphviz=2.50.0=h1b29801_1 + - gst-plugins-base=1.14.1=h6a678d5_1 + - gstreamer=1.14.1=h5eee18b_1 + - gtk2=2.24.33=h73c1081_2 + - gts=0.7.6=hb67d8dd_3 + - gxx_impl_linux-64=13.1.0=hc4be1a9_0 + - gxx_linux-64=13.1.0=h5006d2a_0 + - harfbuzz=4.3.0=hf52aaf7_1 + - icu=58.2=he6710b0_3 + - idna=3.4=py38h06a4308_0 + - imbalanced-learn=0.11.0=pyhd8ed1ab_0 + - intel-openmp=2023.1.0=hdb19cb5_46305 + - joblib=1.2.0=py38h06a4308_0 + - jpeg=9e=h5eee18b_1 + - kernel-headers_linux-64=2.6.32=he073ed8_15 + - kiwisolver=1.4.2=py38h295c915_0 + - krb5=1.20.1=h143b758_1 + - lcms2=2.12=h3be6417_0 + - ld_impl_linux-64=2.40=h41732ed_0 + - lerc=3.0=h295c915_0 + - libboost=1.73.0=h28710b8_12 + - libbrotlicommon=1.0.9=h5eee18b_7 + - libbrotlidec=1.0.9=h5eee18b_7 + - libbrotlienc=1.0.9=h5eee18b_7 + - libcurl=8.2.1=h251f7ec_0 + - libdeflate=1.17=h5eee18b_0 + - libedit=3.1.20221030=h5eee18b_0 + - libev=4.33=h7f8727e_1 + - libevent=2.1.12=hdbd6064_1 + - libffi=3.4.4=h6a678d5_0 + - libgcc-devel_linux-64=13.1.0=he3cc6c4_0 + - libgcc-ng=13.1.0=he5830b7_0 + - libgd=2.3.3=h6a678d5_3 + - libgfortran-ng=13.1.0=h69a702a_0 + - libgfortran5=13.1.0=h15d22d2_0 + - libgomp=13.1.0=he5830b7_0 + - libiconv=1.16=h7f8727e_2 + - libllvm10=10.0.1=hbcb73fb_5 + - libnghttp2=1.52.0=h2d74bed_1 + - libpng=1.6.39=h5eee18b_0 + - libpq=12.15=hdbd6064_1 + - librsvg=2.54.4=h36cc946_2 + - libsanitizer=13.1.0=hfd8a6a1_0 + - libssh2=1.10.0=hdbd6064_2 + - libstdcxx-devel_linux-64=13.1.0=he3cc6c4_0 + - libstdcxx-ng=13.1.0=hfd8a6a1_0 + - libtiff=4.5.0=h6a678d5_2 + - libtool=2.4.6=h6a678d5_1009 + - libuuid=1.41.5=h5eee18b_0 + - libwebp=1.2.4=h11a3e52_1 + - libwebp-base=1.2.4=h5eee18b_1 + - libxcb=1.15=h7f8727e_0 + - libxgboost=1.7.3=h6a678d5_0 + - libxkbcommon=1.0.1=hfa300c1_0 + - libxml2=2.9.14=h74e7548_0 + - libxslt=1.1.35=h4e12654_0 + - libzlib=1.2.13=hd590300_5 + - lz4-c=1.9.4=h6a678d5_0 + - matplotlib=3.5.1=py38h06a4308_1 + - matplotlib-base=3.5.1=py38ha18d171_1 + - mkl=2023.1.0=h6d00ec8_46342 + - mkl-service=2.4.0=py38h5eee18b_1 + - mkl_fft=1.3.6=py38h417a72b_1 + - mkl_random=1.2.2=py38h417a72b_1 + - mpi=1.0=openmpi + - mpi4py=3.1.4=py38h64caa1c_0 + - munkres=1.1.4=py_0 + - nano=7.2=h8228510_0 + - ncurses=6.4=h6a678d5_0 + - ninja=1.10.2=h06a4308_5 + - ninja-base=1.10.2=hd09550d_5 + - nspr=4.35=h6a678d5_0 + - nss=3.89.1=h6a678d5_0 + - numexpr=2.8.4=py38hc78ab66_1 + - numpy=1.24.3=py38hf6e8229_1 + - numpy-base=1.24.3=py38h060ed82_1 + - openjpeg=2.4.0=h3ad879b_0 + - openmpi=4.1.5=h414af15_101 + - openssl=3.1.3=hd590300_0 + - packaging=21.3=pyhd3eb1b0_0 + - pandas=1.4.2=py38h295c915_0 + - pango=1.50.7=h05da053_0 + - pcre=8.45=h295c915_0 + - pillow=9.4.0=py38h6a678d5_0 + - pip=23.1.2=py38h06a4308_0 + - pixman=0.40.0=h7f8727e_1 + - ply=3.11=py38_0 + - pooch=1.4.0=pyhd3eb1b0_0 + - poppler=22.12.0=h9614445_1 + - poppler-data=0.4.11=h06a4308_1 + - py-xgboost=1.7.3=py38h06a4308_0 + - pycparser=2.21=pyhd3eb1b0_0 + - pyopenssl=23.0.0=py38h06a4308_0 + - pyparsing=3.0.9=py38h06a4308_0 + - pyqt=5.15.7=py38h6a678d5_1 + - pyqt5-sip=12.11.0=py38h6a678d5_1 + - pysocks=1.7.1=py38h06a4308_0 + - python=3.8.16=h955ad1f_4 + - python-dateutil=2.8.2=pyhd3eb1b0_0 + - python_abi=3.8=2_cp38 + - pytz=2022.1=py38h06a4308_0 + - qt-main=5.15.2=h327a75a_7 + - qt-webengine=5.15.9=hd2b0992_4 + - qtwebkit=5.212=h4eab89a_4 + - readline=8.2=h5eee18b_0 + - requests=2.29.0=py38h06a4308_0 + - rust=1.73.0=h70c747d_0 + - rust-std-x86_64-unknown-linux-gnu=1.73.0=hc1431ca_0 + - scikit-learn=1.2.2=py38h6a678d5_1 + - scipy=1.10.1=py38hf6e8229_1 + - setuptools=67.8.0=py38h06a4308_0 + - sip=6.6.2=py38h6a678d5_0 + - six=1.16.0=pyhd3eb1b0_1 + - sqlite=3.41.2=h5eee18b_0 + - sysroot_linux-64=2.12=he073ed8_15 + - tbb=2021.8.0=hdb19cb5_0 + - threadpoolctl=2.2.0=pyh0d69192_0 + - tk=8.6.12=h1ccaba5_0 + - toml=0.10.2=pyhd3eb1b0_0 + - tornado=6.2=py38h5eee18b_0 + - urllib3=1.26.16=py38h06a4308_0 + - wheel=0.38.4=py38h06a4308_0 + - xgboost=1.7.3=py38h06a4308_0 + - xz=5.4.2=h5eee18b_0 + - zlib=1.2.13=hd590300_5 + - zstd=1.5.5=hc292b87_0 + - pip: + - absl-py==1.4.0 + - astunparse==1.6.3 + - baidu-aip==4.16.12 + - cachetools==5.3.1 + - click==8.1.7 + - cmake==3.27.2 + - cssselect==1.2.0 + - ddsketch==2.0.4 + - dlib==19.24.2 + - dnspython==2.4.2 + - face-recognition==1.3.0 + - face-recognition-models==0.3.0 + - filelock==3.12.2 + - flatbuffers==23.5.26 + - gast==0.4.0 + - google-auth==2.23.0 + - google-auth-oauthlib==1.0.0 + - google-pasta==0.2.0 + - grpcio==1.58.0 + - h5py==3.9.0 + - importlib-metadata==6.8.0 + - jieba==0.42.1 + - jinja2==3.1.2 + - keras==2.13.1 + - libclang==16.0.6 + - lit==16.0.6 + - lxml==4.9.3 + - markdown==3.4.4 + - markupsafe==2.1.3 + - maturin==1.3.0 + - memory-profiler==0.61.0 + - mpmath==1.3.0 + - networkx==3.1 + - nvidia-cublas-cu11==11.10.3.66 + - nvidia-cuda-cupti-cu11==11.7.101 + - nvidia-cuda-nvrtc-cu11==11.7.99 + - nvidia-cuda-runtime-cu11==11.7.99 + - nvidia-cudnn-cu11==8.5.0.96 + - nvidia-cufft-cu11==10.9.0.58 + - nvidia-curand-cu11==10.2.10.91 + - nvidia-cusolver-cu11==11.4.0.1 + - nvidia-cusparse-cu11==11.7.4.91 + - nvidia-nccl-cu11==2.14.3 + - nvidia-nvtx-cu11==11.7.91 + - oauthlib==3.2.2 + - opencv-python==4.8.1.78 + - opt-einsum==3.3.0 + - phe==1.5.0 + - protobuf==4.24.2 + - psutil==5.9.5 + - pyasn1==0.5.0 + - pyasn1-modules==0.3.0 + - pydp==0.1.16 + - pydub==0.25.1 + - pymongo==4.5.0 + - pymysql==1.1.0 + - pyquery==2.0.0 + - python-chess==0.27.0 + - python-dp==1.1.1 + - python-graphviz==0.20.1 + - pyyaml==6.0.1 + - requests-oauthlib==1.3.1 + - rsa==4.9 + - sds==2.0.1 + - sds-pyo3==1.9.0 + - seaborn==0.13.0 + - sfxgboost==0.1.0 + - sympy==1.12 + - tensorboard==2.13.0 + - tensorboard-data-server==0.7.1 + - tensorflow==2.13.0 + - tensorflow-estimator==2.13.0 + - tensorflow-io-gcs-filesystem==0.34.0 + - termcolor==2.3.0 + - tomli==2.0.1 + - torch==2.0.1 + - tqdm==4.66.1 + - triton==2.0.0 + - typing-extensions==4.5.0 + - ucimlrepo==0.0.2 + - werkzeug==2.3.7 + - wrapt==1.15.0 + - xpinyin==0.7.6 + - zipp==3.16.2 +prefix: /home/meerhofj/.conda/envs/fedxgboost_mpi diff --git a/environment_hist.yml b/environment_hist.yml new file mode 100644 index 0000000..4fe52be --- /dev/null +++ b/environment_hist.yml @@ -0,0 +1,31 @@ +name: fedxgboost_mpi +channels: + - defaults +dependencies: + - python=3.8 + - packaging=21.3 + - fonttools + - numpy + - kiwisolver=1.4.2 + - pandas=1.4.2 + - matplotlib=3.5.1 + - pytz=2022.1 + - mpi4py + - six=1.16.0 + - pillow + - python-dateutil=2.8.2 + - scipy + - xgboost + - cycler=0.11.0 + - pyparsing + - ca-certificates + - certifi + - openssl + - openmpi + - gxx_linux-64 + - gcc + - nano + - graphviz + - imbalanced-learn + - rust +prefix: /home/meerhofj/.conda/envs/fedxgboost_mpi diff --git a/run_experiment.sh b/run_experiment.sh index fe9ba15..7ec424f 100755 --- a/run_experiment.sh +++ b/run_experiment.sh @@ -6,10 +6,10 @@ errorfile="error_${name}${experiment}.txt" case "$experiment" in "1") - rm $outputfile $errorfile & pip install . && bsub -J $name -q bio -n 10 -M 32G -R "rusage[mem=32G]" -o $outputfile -e $errorfile mpiexec -np 5 /home/meerhofj/.conda/envs/fedxgboost_mpi/bin/python tests/main.py $experiment + rm $outputfile $errorfile & pip install . && bsub -J $name -q bio -n 12 -M 32G -R "rusage[mem=32G]" -o $outputfile -e $errorfile mpiexec -np 5 /home/meerhofj/.conda/envs/fedxgboost_mpi/bin/python tests/main.py $experiment ;; - "2") - rm $outputfile $errorfile & pip install . && bsub -J $name -q bio -n 12 -M 128G -R "rusage[mem=128G]" -o $outputfile -e $errorfile mpiexec -np 4 /home/meerhofj/.conda/envs/fedxgboost_mpi/bin/python tests/main.py $experiment + "2" | "3") + rm $outputfile $errorfile & pip install . && bsub -J $name -q bio -n 26 -M 128G -R "rusage[mem=128G]" -o $outputfile -e $errorfile mpiexec -np 3 /home/meerhofj/.conda/envs/fedxgboost_mpi/bin/python tests/main.py $experiment ;; *) echo "only experiment 1 and 2 exist!" diff --git a/src/SFXGBoost/MemberShip.py b/src/SFXGBoost/MemberShip.py index b6a7ec0..a25ab06 100644 --- a/src/SFXGBoost/MemberShip.py +++ b/src/SFXGBoost/MemberShip.py @@ -44,11 +44,11 @@ def f_random(D_Train_Shadow, D_Out_Shadow, seed=0, take=0): X_Train_Shadow = D_Train_Shadow[0][:min_lenght, :] X_Out_Shadow = D_Out_Shadow[0][:min_lenght, :] if take != 0: - take = take//2 + take = take//2 # TODO investigate centralised! if seed != 0: np.random.seed(int(seed)) - take = min(take, min_lenght) # don't take more than you can - indices = np.random.choice(min_lenght, int(take), replace=True) + take = min(take, min_lenght) # don't take more than you can + indices = np.random.choice(min_lenght, int(take), replace=False) X_Train_Shadow = X_Train_Shadow[indices] X_Out_Shadow = X_Out_Shadow[indices] @@ -70,10 +70,15 @@ def f_random(D_Train_Shadow, D_Out_Shadow, seed=0, take=0): # print(f"X_Train_Attack = {X_Train_Attack.shape}") return X_Train_Attack, labels -def create_D_attack_centralised(shadow_model_s, D_Train_Shadow, D_Out_Shadow): +def create_D_attack_centralised(shadow_model_s, D_Train_Shadow, D_Out_Shadow, config:Config=None): # Shadow_model_s can be multiple shadow_models! TODO deal with that! x, labels = f_random(D_Train_Shadow, D_Out_Shadow) - z = shadow_model_s.predict_proba(x) + z = None + if type(shadow_model_s) == SFXGBoost: + print(f"target rank = {config.target_rank}") + z = shadow_model_s.predict_proba(x, config.target_rank) + else: + z = shadow_model_s.predict_proba(x) # z_top_indices = np.argsort(z)[::-1][:3] # take top 3 sorted by probability # z = np.take(z, z_top_indices) # take top 3 return z, labels @@ -84,7 +89,7 @@ def get_G_H(config:Config, node): else: return flatten_list([node.G, node.H]) -def get_info_node(config:Config, x, node=None): +def get_info_node(config:Config, x:np.array, node=None): # for node in nodes: splittinginfo = [] parent:FLTreeNode = node.parent @@ -116,31 +121,33 @@ def get_train_Attackmodel_1(config:Config, logger:Logger, n_shadows, c, d, D_Tra input = None D_Train_Attack = None # c, l empty lists size is nshadows * (len(D_train_shadow)*2) * n_nodes # where n_nodes scales exponentially y=[] - max_lenght = 50_000 # try to devide the max_lenght over the different nodes over the available trees. - max_lenght_shadow = max_lenght/n_shadows - max_length_shadow_tree = max_lenght_shadow / config.max_tree + max_length = 50_000 # try to devide the max_lenght over the different nodes over the available trees. + max_length_shadow = max_length//n_shadows #TODO take randomly from t, node, then add all NO DUPES x's # for a in range(n_shadows): + logger.warning(f"attack1 creation shadow model {a} out of {n_shadows} for c={c}, d={d}") shadow_model:SFXGBoost = retrieve("shadow_model_" + str(a), config) - nodes = shadow_model.nodes[c][d] + nodes = np.array(shadow_model.nodes[c][d]) # can be zero + if len(nodes) == 0: + max_length_shadow += max_length_shadow//(n_shadows-a) # devide the nodes to be put here over the other nodes of other shadow models + continue + x_len = len(D_Train_Shadow[a][0]) + len(D_Train_Shadow[(a+2)%len(D_Train_Shadow)][0]) + + wish_to_take = int(np.min((max_length_shadow, x_len, len(nodes)))) + + # TODO take 1, but make it unique such that x is not used twice, not vital but could skew results a tiny bit. + x, labels_train = f_random(D_Train_Shadow[a], D_Train_Shadow[(a+2) % len(D_Train_Shadow)], seed=a+c+d, take=wish_to_take) #int(max_length_shadow_tree_node) - indices = np.random.choice(int(len(nodes)), int(np.min((max_length_shadow_tree, len(nodes)))), replace=True) + indices = np.random.choice(int(len(nodes)), len(x), replace=False) random_nodes = nodes[indices] - - max_length_shadow_tree_node = None - if len(random_nodes) < max_length_shadow_tree: - max_length_shadow_tree_node = max_length_shadow_tree // len(random_nodes) - else: - max_length_shadow_tree_node = 1 for nodepos, node in enumerate(random_nodes): - x, labels_train = f_random(D_Train_Shadow[a], D_Train_Shadow[(a+2) % len(D_Train_Shadow)], seed=nodepos+a+c+d, take=max_length_shadow_tree_node) #int(max_length_shadow_tree_node) # z = shadow_model.predict_proba(x) - input = get_info_node(config, x, node) - y.extend(labels_train) + input = get_info_node(config, np.array([x[nodepos]]), node) # take one of the x's linked to the node, and get the G,H + y.append(labels_train[nodepos]) # append would be nicer, if not D_Train_Attack is None: D_Train_Attack = np.vstack((D_Train_Attack, input)) @@ -148,26 +155,6 @@ def get_train_Attackmodel_1(config:Config, logger:Logger, n_shadows, c, d, D_Tra D_Train_Attack = input return D_Train_Attack, np.array(y) # .reshape(-1, 1) -def get_input_attack2dot1(config:Config, logger:Logger, D_train_shadow, models, attack_models): - - - input_attack_2 = [] - y_attack_2 = [] - nModels = len(models) - - D_train_shadow_offset = [D_train_shadow[a+1] for a in range(nModels)] - for c in config.nClasses: - for d in config.max_depth: - x_attack_1_cd, y_attack_1_cd = get_train_Attackmodel_1(config, logger, models, c, d, D_train_shadow_offset) - y_pred = attack_models[c][d].predict_proba(x_attack_1_cd) - if input_attack_2 == []: - input_attack_2 = y_pred - else: - input_attack_2 = np.column_stack((input_attack_2, y_pred)) - y_attack_2.append(y_attack_1_cd) - return input_attack_2, y_attack_2 - - def get_input_attack2(config:Config, D_Train_Shadow, n_models, attack_models): input_attack_2 = [] y_attack_2 = [] @@ -192,17 +179,20 @@ def get_input_attack2(config:Config, D_Train_Shadow, n_models, attack_models): for c in range(config.nClasses): for d in range(config.max_depth): all_p = None - for t in range(config.max_tree): - nodes = model.trees[c][t].root.get_nodes_depth(d) - if nodes == []: - continue - for node in nodes: - node_params = get_info_node(config, x ,node) #size = 2000 - list_of_outputs = attack_models[c][d].predict_proba(node_params)[:, 1] # returns two dimentional array!!!! - if all_p is None: - all_p = list_of_outputs - else: - all_p = np.column_stack((all_p, list_of_outputs)) # all probas for every x + # nodes = model.trees[c][t].root.get_nodes_depth(d) + nodes = model.nodes[c][d] + if nodes == []: + continue + for node in nodes: + + node_params = get_info_node(config, x ,node) #size = 2000 + list_of_outputs = attack_models[c][d].predict_proba(node_params)[:, 1] # returns two dimentional array!!!! + + if all_p is None: + all_p = list_of_outputs + else: + all_p = np.column_stack((all_p, list_of_outputs)) # all probas for every x + if all_p is None: print(f"Warning, at depth {d} of model {a} no nodes were found accross all trees of class {c}?!") if (input is None): @@ -210,9 +200,6 @@ def get_input_attack2(config:Config, D_Train_Shadow, n_models, attack_models): else: input = np.column_stack((input, np.zeros( (x.shape[0],1) ))) else: - # print("----") - # print( all_p ) - # print("----") avg = np.average(all_p, axis=1).reshape((-1,1)) # min = np.min(all_p, axis=1).reshape((-1,1)) # max = np.max(all_p, axis=1).reshape((-1,1)) diff --git a/src/SFXGBoost/Model.py b/src/SFXGBoost/Model.py index c520b5c..ad5795f 100644 --- a/src/SFXGBoost/Model.py +++ b/src/SFXGBoost/Model.py @@ -123,7 +123,7 @@ def boost(self, init_Probas): # print("#####################") nodes = [[self.trees[c][t].root] for c in range(self.config.nClasses)] - for l in range(self.config.max_depth+1): + for d in range(self.config.max_depth): G = [[ [] for _ in range(len(nodes[c])) ] for c in range(self.config.nClasses)] H = [[ [] for _ in range(len(nodes[c])) ] for c in range(self.config.nClasses)] for Pi in range(1, comm.Get_size()): @@ -162,12 +162,12 @@ def boost(self, init_Probas): # results = list(executor.map(test, range(len(nodes[c])))) # print(results) for i, n in enumerate(nodes[c]): #TODO multithread! - split_cn = self.find_split(splits, G[c][i], H[c][i], l == self.config.max_depth) + split_cn = self.find_split(splits, G[c][i], H[c][i], d == self.config.max_depth) splittingInfos[c].append(split_cn) for Pi in range(1, comm.Get_size()): comm.send(splittingInfos, Pi, tag=MSG_ID.SPLIT_UPDATE ) - nodes = self.update_trees(nodes, splittingInfos, l) + nodes = self.update_trees(nodes, splittingInfos, d) # update own my own trees to attack users #################### @@ -203,7 +203,7 @@ def boost(self, init_Probas): G, H = np.array(G).T, np.array(H).T # (nClasses, nUsers) nodes = [[self.trees[c][t].root] for c in range(self.config.nClasses)] - for l in range(self.config.max_depth+1): + for d in range(self.config.max_depth): Gnodes = [[] for _ in range(self.config.nClasses)] Hnodes = [[] for _ in range(self.config.nClasses)] @@ -220,7 +220,7 @@ def boost(self, init_Probas): self.logger.warning("sending G,H") comm.send((Gnodes,Hnodes), PARTY_ID.SERVER, tag=MSG_ID.RESPONSE_GRADIENTS) splits = comm.recv(source=PARTY_ID.SERVER, tag=MSG_ID.SPLIT_UPDATE) - nodes = self.update_trees(nodes, splits, l) # also update Instances + nodes = self.update_trees(nodes, splits, d) # also update Instances # for c in range(self.config.nClasses): # FLVisNode(self.logger, self.trees[c][t].root).display(t) update_pred = np.array([tree.predict(orgData) for tree in self.trees[:, t]]).T @@ -345,13 +345,19 @@ def update_trees(self, last_level_nodes:List[List[FLTreeNode]], splits:List[List node.rightBranch.instances = np.logical_and([self.original_data.featureDict[fName][index] > sValue for index in range(self.nUsers)], node.instances) new_nodes[c].append(node.leftBranch) new_nodes[c].append(node.rightBranch) - self.nodes[c][depth].append(node.leftBranch) - self.nodes[c][depth].append(node.rightBranch) - else: + else: # leaf node node.weight = splitInfo.weight + for p in range(0, comm.Get_size() -1): + if rank == PARTY_ID.SERVER: + # print(f"DEBUG gpi shape{np.array(node.Gpi[p]).shape}") + node.weightpi[p], scorep = FLTreeNode.compute_leaf_param(node.Gpi[p][0], node.Hpi[p][0], self.config.lam, self.config.alpha) + node.weightpi[p] = node.weightpi[p] * self.config.learning_rate node.score = splitInfo.nodeScore node.leftBranch = None node.rightBranch = None + + self.nodes[c][depth].append(node) + return new_nodes def appendGradients(self, instances, G, H, orgData): @@ -394,7 +400,7 @@ def appendGradients(self, instances, G, H, orgData): def fit(self, X_train, y_train, fName): - quantile = QuantiledDataBase(DataBase.data_matrix_to_database(X_train, fName) ) + quantile = QuantiledDataBase(DataBase.data_matrix_to_database(X_train, fName), self.config ) ## DEL CONFIG if errors occur 12-oct initprobability = (sum(y_train))/len(y_train) total_users = comm.Get_size() - 1 @@ -432,17 +438,17 @@ def fit(self, X_train, y_train, fName): self.boost(initprobability) return self - def predict(self, X): # returns class number + def predict(self, X, pi=-1): # returns class number """returns one dimentional array of multi-class predictions Returns: _type_: _description_ """ - y_pred = self.predict_proba(X) # get leaf node weights + y_pred = self.predict_proba(X, pi) # get leaf node weights return np.argmax(y_pred, axis=1) - def predict_proba(self, X): # returns probabilities of all classes - y_pred = self.predictweights(X) # returns weights + def predict_proba(self, X, pi=-1): # returns probabilities of all classes + y_pred = self.predictweights(X, pi) # returns weights for rowid in range(np.shape(y_pred)[0]): row = y_pred[rowid, :] wmax = max(row) @@ -451,7 +457,7 @@ def predict_proba(self, X): # returns probabilities of all classes y_pred[rowid, :] = np.exp(row-wmax) / wsum return y_pred - def predictweights(self, X): # returns weights + def predictweights(self, X, pi=-1): # returns weights # if type(X) == np.ndarray: # X = DataBase.data_matrix_to_database(X, self.fName) @@ -471,7 +477,7 @@ def predictweights(self, X): # returns weights # self.logger.warning(f"PREDICTION id {treeID}") # b = FLVisNode(self.logger, tree.root) # b.display(treeID) - update_pred = tree.predict(testDataBase) + update_pred = tree.predict(testDataBase, pi) y_pred[:, c] += update_pred #* self.config.learning_rate return y_pred @@ -491,7 +497,7 @@ def setInstances(self, nUsers, instances): self.root.nUsers = nUsers self.root.instances = instances - def predict(self, data:DataBase): + def predict(self, data:DataBase, pi=-1): curNode = self.root outputs = np.empty(data.nUsers, dtype=float) @@ -505,4 +511,7 @@ def predict(self, data:DataBase): elif(direction == Direction.RIGHT): curNode = curNode.rightBranch outputs[userId] = curNode.weight + if pi > 0: # 0 == server, > 0 == participants + outputs[userId] = curNode.weightpi[pi-1] + # TODO add weightpi return return outputs \ No newline at end of file diff --git a/src/SFXGBoost/data_structure/databasestructure.py b/src/SFXGBoost/data_structure/databasestructure.py index c8894ae..2ed432e 100644 --- a/src/SFXGBoost/data_structure/databasestructure.py +++ b/src/SFXGBoost/data_structure/databasestructure.py @@ -4,7 +4,7 @@ from SFXGBoost.common.BasicTypes import Direction from SFXGBoost.data_structure.treestructure import SplittingInfo -from SFXGBoost.config import rank +from SFXGBoost.config import Config, rank class QuantileParam: epsilon = 0.05 # privacy parameter @@ -17,14 +17,14 @@ def __init__(self, name, dataVector) -> None: class QuantiledFeature(FeatureData): - def __init__(self, name, dataVector, splittingMatrix = None, splittingCandidates = None) -> None: + def __init__(self, name, dataVector, splittingMatrix = None, splittingCandidates = None, config:Config = None) -> None: super().__init__(name, dataVector) if (splittingCandidates is None): - self.splittingMatrix, self.splittingCandidates = QuantiledFeature.quantile(self.data, QuantileParam) + self.splittingMatrix, self.splittingCandidates = QuantiledFeature.quantile(self.data, config) else: self.splittingMatrix, self.splittingCandidates = splittingMatrix, splittingCandidates - def quantile(fData: FeatureData, param: QuantileParam): + def quantile(fData: FeatureData, config:Config = None): splittingMatrix = [] splittingCandidates = [] # from ddsketch import DDSketch @@ -32,16 +32,19 @@ def quantile(fData: FeatureData, param: QuantileParam): # for v in fData: # sketch.add(v) + nBuckets = 100 + if config != None: + nBuckets = config.nBuckets - if len(np.unique(fData)) > 101: + if len(np.unique(fData)) > nBuckets+1: pass - range_min = np.min(fData) - range_max = np.max(fData) + # range_min = np.min(fData) + # range_max = np.max(fData) from ddsketch import DDSketch sketch = DDSketch() for value in fData: sketch.add(value) - quantiles = np.array([sketch.get_quantile_value(q/100) for q in range(0, 100, 1)]) + quantiles = np.array([sketch.get_quantile_value(q/nBuckets) for q in range(0, nBuckets, 1)]) # print(f"DEBUG: {quantiles}") splittingCandidates = quantiles @@ -199,19 +202,20 @@ def __init__(self, dataBase:DataBase = None) -> None: class QuantiledDataBase(DataBase): - def __init__(self, dataBase:DataBase = None) -> None: + def __init__(self, dataBase:DataBase = None, config:Config = None) -> None: super().__init__() self.nUsers = dataBase.nUsers + self.config = config # Perform the quantiled for all the feature (copy, don't change the orgiginal data) if dataBase is not None: for fName, fData in dataBase.featureDict.items(): - self.featureDict[fName] = QuantiledFeature(fName, fData) + self.featureDict[fName] = QuantiledFeature(fName, fData, config=self.config) self.gradVec = [] self.hessVec = [] def splitupHorizontal(self, start:int, end:int): - newQDatabase = QuantiledDataBase(DataBase()) + newQDatabase = QuantiledDataBase(DataBase(), self.config) newQDatabase.nUsers = end - start newQDatabase.featureDict = {} # self.splittingMatrix, self.splittingCandidates = QuantiledFeature.quantile(self.data, QuantileParam) @@ -219,9 +223,9 @@ def splitupHorizontal(self, start:int, end:int): for featurestring, qFeature in self.featureDict.items(): newdata = qFeature.data[start:end] if qFeature.splittingCandidates.size != 0: - newQDatabase.featureDict[featurestring] = QuantiledFeature(name=featurestring, dataVector=newdata, splittingCandidates=qFeature.splittingCandidates) + newQDatabase.featureDict[featurestring] = QuantiledFeature(name=featurestring, dataVector=newdata, splittingCandidates=qFeature.splittingCandidates, config=self.config) else: # empty - newQDatabase.featureDict[featurestring] = QuantiledFeature(name=featurestring, dataVector=newdata, splittingCandidates=qFeature.splittingCandidates) + newQDatabase.featureDict[featurestring] = QuantiledFeature(name=featurestring, dataVector=newdata, splittingCandidates=qFeature.splittingCandidates, config=self.config) return newQDatabase def get_info_string(self): diff --git a/src/SFXGBoost/data_structure/treestructure.py b/src/SFXGBoost/data_structure/treestructure.py index 0bd249f..3878589 100644 --- a/src/SFXGBoost/data_structure/treestructure.py +++ b/src/SFXGBoost/data_structure/treestructure.py @@ -52,6 +52,7 @@ def __init__(self, weight = 0.0, leftBranch=None, rightBranch=None): self.weight = weight self.leftBranch = leftBranch self.rightBranch = rightBranch + self.weightpi = [ 0 for _ in range(comm.Get_size() -1)] def logNode(self, logger): @@ -89,7 +90,7 @@ def __init__(self, FID = 0, weight=0, parent=None, leftBranch=None, rightBranch= self.Hpi = [ [] for _ in range(comm.Get_size() - 1)] self.splitting_sgh = None # NOT USED YET self.splitting_sgh = None # store parent's splits, + your gradients - + def get_nodes_depth(self, l, cur_l=0): """retrieves all the nodes that are at depth l [0, max_depth] diff --git a/src/SFXGBoost/dataset/datasetRetrieval.py b/src/SFXGBoost/dataset/datasetRetrieval.py index b63b907..d0d761e 100644 --- a/src/SFXGBoost/dataset/datasetRetrieval.py +++ b/src/SFXGBoost/dataset/datasetRetrieval.py @@ -7,6 +7,9 @@ dataset_list = ['purchase-10', 'purchase-20', 'purchase-50', 'purchase-100', 'texas', 'MNIST', 'synthetic', 'Census', 'DNA'] def apply_DP(X, y): + import pydp + pydp.algorithms.laplacian.BoundedStandardDeviation + pydp.LaplacePrivacy({'epsilon':epsilon}) sensitivity = 1 epsilon = 1 scale = sensitivity/epsilon @@ -240,10 +243,14 @@ def getHealthcare(paths, federated=False, train_size=2_000): # https://www.kaggl _type_: _description_ """ - n_shadows = 100 + n_shadows = 300 # A MINIMUM OF 4 SHADOWS ARE NEEDED!!! def returnfunc(): train = check_mul_paths_csv("AV_HealthcareAnalyticsII/train_data", paths) + # train_dp = check_mul_paths_csv("AV_HealthcareAnalyticsII/train_data_dp", paths) + + # x = pd.read_csv('/data/BioGrid/meerhofj/Database/AV_HealthcareAnalyticsII/train_data_dp.tsv', sep='\t') + # test = check_mul_paths_csv("AV_HealthcareAnalyticsII/test_data", paths) # dict = check_mul_paths_csv("AV_HealthcareAnalyticsII/train_data_dictionary", paths) # sample = check_mul_paths_csv("AV_HealthcareAnalyticsII/sample_sub", paths) @@ -308,4 +315,6 @@ def getConfigParams(dataBaseName): # retreive n_classes, n_features 'Census':(-1, -1), 'DNA':(-1, -1) }[dataBaseName] - return get_databasefunc[0], get_databasefunc[1] \ No newline at end of file + return get_databasefunc[0], get_databasefunc[1] + +# x = 1 \ No newline at end of file diff --git a/src/SFXGBoost/view/plotter.py b/src/SFXGBoost/view/plotter.py index 684d7f6..2c463be 100644 --- a/src/SFXGBoost/view/plotter.py +++ b/src/SFXGBoost/view/plotter.py @@ -73,12 +73,12 @@ def plot_histogram(datasets, data, title="Sample text", y_label="y_label", desti day = date.today().strftime("%b-%d-%Y") curTime = time.strftime("%H:%M", time.localtime()) destination = destination.replace(".jpeg", f"{day},{curTime}.jpeg") - width = 0.25 multiplier = 0 x = np.arange(len(datasets)) fig, ax = plt.subplots(layout='constrained') for attribute, measurements in data.items(): + measurements = [round(value, 3,) for value in measurements] offset = width * multiplier rects = ax.bar(x+offset, measurements, width, label=attribute) ax.bar_label(rects, padding=3) diff --git a/src/SFXGBoost/view/table.py b/src/SFXGBoost/view/table.py index de55fa6..881b9a6 100644 --- a/src/SFXGBoost/view/table.py +++ b/src/SFXGBoost/view/table.py @@ -5,7 +5,7 @@ def create_latex_table_tmp(h_axis, data, name): latex_table = "\\begin{table}[h]\n" latex_table += "\\centering\n" - latex_table += "\\begin{tabular}{| "+ "|".join(["c" for _ in h_axis]) + "|}\n\\hline" + latex_table += "\\begin{tabular}{|"+ "|".join(["c" for _ in h_axis]) + "|}\n\\hline" latex_table += "\n" + " & ".join(h_axis) + "\\\\\n\\hline\n" for key, value in data.items(): @@ -18,6 +18,8 @@ def create_latex_table_tmp(h_axis, data, name): output_filename = name + ".tex" + output_filename = output_filename.replace("_", "\_") + with open(output_filename, 'w') as f: f.write(latex_table) @@ -33,16 +35,6 @@ def create_table_config_variable(name, modeltype, *args, **kwargs): data["model"] = modeltype create_latex_table_tmp(h_axis, data, "./Table/config_" + name) return - if modeltype(model) is xgb.XGBClassifier: - pass - xgb.XGBClassifier.get_params - elif modeltype(model) is MLPClassifier: - data = kwargs - create_latex_table_tmp(h_axis, data, "./Table/config_" + name) - elif modeltype(model) is SFXGBoost: - # create_table_config(kwargs["alpha"],kwargs["gamma"], kwargs["lam"], kwargs["learning_rate"], kwargs["max_depth"], kwargs["max_tree"], ) - data = kwargs - create_latex_table_tmp(h_axis, data, "./Table/config_" + name) def create_latex_table_1(all_data, to_be_tested, metrics, name_model, datasets, destination="Table/experiment_1_.txt"): diff --git a/tests/main.py b/tests/main.py index 32fd52e..823899b 100644 --- a/tests/main.py +++ b/tests/main.py @@ -29,7 +29,7 @@ def log_distribution(logger, X_train, y_train, y_test): nTrain, rTrain, nTest, rTest, X_train.shape[1]) def fit(X_train, y_train, X_test, fName, model): - quantile = QuantiledDataBase(DataBase.data_matrix_to_database(X_train, fName) ) + quantile = QuantiledDataBase(DataBase.data_matrix_to_database(X_train, fName)) initprobability = (sum(y_train))/len(y_train) total_users = comm.Get_size() - 1 @@ -93,7 +93,12 @@ def test_global(config:Config, logger:Logger, model: SFXGBoostClassifierBase, ge "/home/hacker/jaap_cloud/SchoolCloud/Master Thesis/Database/", \ "/home/jaap/Documents/JaapCloud/SchoolCloud/Master Thesis/Database/"] -def get_data_attack_centrally(target_model, shadow_model, attack_model, config, logger:Logger, name="sample"): +def get_data_attack_federated2(target_model, shadow_model, attack_model, config:Config, logger:Logger): + X_train, y_train, X_test, y_test, fName, X_shadow, y_shadow = getDataBase(config.dataset, POSSIBLE_PATHS, False, config.train_size)() + log_distribution(logger, X_train, y_train, y_test) + + +def get_data_attack_centrally(target_model, shadow_model, attack_model, config:Config, logger:Logger, name="sample"): # TODO keep track of rank X_train, y_train, X_test, y_test, fName, X_shadow, y_shadow = getDataBase(config.dataset, POSSIBLE_PATHS, False, config.train_size)() log_distribution(logger, X_train, y_train, y_test) @@ -104,11 +109,20 @@ def get_data_attack_centrally(target_model, shadow_model, attack_model, config, else: target_model.fit(X_train, np.argmax(y_train, axis=1)) shadow_model.fit(D_Train_Shadow[0], np.argmax(D_Train_Shadow[1], axis=1)) - z, labels = create_D_attack_centralised(shadow_model, D_Train_Shadow, D_Out_Shadow) data = None if rank == PARTY_ID.SERVER: + print(f"DEBUG: target rank = {config.target_rank}, name = {name}") + if config.target_rank > 0 and name == "FederBoost-Federated-2" : + pickle.dump(shadow_model, open("./delme.p", 'wb')) + print("went intside if") + X_train, y_train = devide_D_Train(X_train, y_train, config.target_rank, config.data_devision) + D_Train_Shadow = devide_D_Train(D_Train_Shadow[0], D_Train_Shadow[1], config.target_rank, config.data_devision) + X_test, y_test = devide_D_Train(X_test, y_test, config.target_rank, config.data_devision) + + z, labels = create_D_attack_centralised(shadow_model, D_Train_Shadow, D_Out_Shadow, config) + attack_model.fit(z, labels) - z_test, labels_test = create_D_attack_centralised(target_model, (X_train, y_train), (X_test, y_test)) + z_test, labels_test = create_D_attack_centralised(target_model, (X_train, y_train), (X_test, y_test), config) data = retrieve_data(target_model, shadow_model, attack_model, X_train, y_train, X_test, y_test, z_test, labels_test) logger.warning("accuracy test attack: " + str(data["accuracy test attack"])) @@ -146,6 +160,10 @@ def concurrent_multi(c, config, logger, shadow_models, D_Train_Shadow, attack_mo D_Train_Attack, y = get_train_Attackmodel_1(config, shadow_models, c, l, D_Train_Shadow) # TODO this is too slow, multithread? attack_models[c][l] = retrieveorfit(attack_models[c][l], f"Attack_model {c},{l}", config, D_Train_Attack, np.array(y)) +def use_federated2(target_model, shadow_model, attack_model, config, logger) -> dict: + X_train, y_train, X_test, y_test, fName, X_shadow, y_shadow = getDataBase(config.dataset, POSSIBLE_PATHS, True, config.train_size)() + + def train_all_federated(target_model, shadow_models, attack_models1:List, attack_model2, config:Config, logger:Logger) -> dict: """Trains for a federated attack given the target_model, shadow_model(s), attack_model, config, logger @@ -193,7 +211,7 @@ def train_all_federated(target_model, shadow_models, attack_models1:List, attack X_train, y_train = devide_D_Train(X_train, y_train, config.target_rank, config.data_devision) # change D_target to be the same as actually used by the targeted user X_test, y_test = devide_D_Train(X_test, y_test, config.target_rank, config.data_devision) # change D_test to be same size as targeted user - with ThreadPoolExecutor(max_workers=10) as executor: + with ThreadPoolExecutor(max_workers=11) as executor: future_D_Train_Attack = [executor.submit(concurrent, config, logger, c, n_shadows, deepcopy(D_Train_Shadow), deepcopy(attack_models1)) for c in range(config.nClasses) ] for future in futures.as_completed(future_D_Train_Attack): @@ -295,6 +313,7 @@ def retrieve_data(target_model, shadow_model, attack_model, X_train, y_train, X_ data["recall test attack"] = recall_test_attack return data + def create_attack_model_federated(config:Config, G:list) -> list: """_summary_ @@ -339,19 +358,21 @@ def experiment1(): # datasets = ["synthetic-10", "synthetic-20", "synthetic-50", "synthetic-100"] - # targetArchitectures = ["XGBoost", "FederBoost-central"] - targetArchitectures = ["FederBoost-central"] + # targetArchitectures = ["XGBoost", "FederBoost-Central"] + targetArchitectures = ["FederBoost-Central"] all_data = {} # all_data["XGBoost"]["healthcore"]["accuarcy train shadow"] # tested_param = "gamma" # tested_param_vals = [0.1, 0.5, 0.7, 0.9, 1] - to_be_tested = {"gamma": [0, 0.1, 0.25, 0.5, 0.75, 1, 5, 10], # [0,inf] minimum loss for split to happen default = 0 - "max_depth": [5, 8, 12, 15], - "max_tree": [5, 10, 20, 30, 50, 100, 150], - # "training_size": [1000, 2000, 5000, 10_000, 30_000], - "alpha": [0, 0.1, 0.25, 0.5, 0.75, 1, 10], # [0, inf] L1 regularisation default = 0 - "lam": [0, 0.1, 0.25, 0.5, 0.75, 1, 10], # L2 regularisation [0, inf] default = 1 - "learning_rate": [0.1, 0.25, 0.5 ,0.75, 1] # learning rate [0,1] default = 0.3 + to_be_tested = { + # "max_tree": [5, 10, 20, 30, 50, 100, 150], + # "max_depth": [5, 8, 12, 15], + # "train_size": [1000, 2000, 5000, 10_000], # learning rate [0,1] default = 0.3 + # "gamma": [0, 0.1, 0.25, 0.5, 0.75, 1, 5, 10], # [0,inf] minimum loss for split to happen default = 0 + # "alpha": [0, 0.1, 0.25, 0.5, 0.75, 1, 10], # [0, inf] L1 regularisation default = 0 + # "lam": [0, 0.1, 0.25, 0.5, 0.75, 1, 10], # L2 regularisation [0, inf] default = 1 + # "learning_rate": [0.1, 0.25, 0.5 ,0.75, 1], + "nBuckets": [10, 20, 50, 100, 1000] } # to_be_tested = {"gamma": [0, 0.1], @@ -378,10 +399,10 @@ def experiment1(): learning_rate=0.3, max_depth=8, max_tree=20, - nBuckets=35, + nBuckets=100, save=False, data_devision=[0.25, 0.25, 0.25, 0.25], - train_size=25_000) + train_size=10_000) create_table_config_variable("experiment1_targetandshadow", modeltype="FederBoost", alpha=config.alpha, gamma=config.gamma, lam=config.lam, @@ -438,7 +459,14 @@ def experiment2dot1(): for dataset in datasets: pass -def experiment2(): +def experiment3(): + datasets = ["healthcare"] + targetArchitectures = ["XGBoost", "FederBoost-Central", "FederBoost-Federated-2"] + all_data = {} # all_data["XGBoost"]["healthcore"]["accuarcy train shadow"] + + + +def experiment2_3(experiment_number:int=2): seed = 10 # datasets = ["healthcare", "MNIST", "synthetic", "Census", "DNA", "Purchase-10", "Purhase-20", "Purchase-50", "Purchase-100"] # datasets = ["synthetic"] @@ -446,39 +474,43 @@ def experiment2(): # datasets = ["healthcare", "synthetic-10", "synthetic-20", "synthetic-50", "synthetic-100"] # datasets = ["synthetic-10", "synthetic-100"] - datasets = ["healthcare"] + datasets = ["healthcare"]#, "synthetic-10", "synthetic-100"] - targetArchitectures = ["XGBoost", "FederBoost-central", "FederBoost-federated"] + targetArchitectures = ["XGBoost", "FederBoost-Central", "FederBoost-Federated-2"] # , "FederBoost-Federated-1"] # targetArchitectures = ["FederBoost-federated"] all_data = {} # all_data["XGBoost"]["healthcore"]["accuarcy train shadow"] for targetArchitecture in targetArchitectures: all_data[targetArchitecture] = {} for dataset in datasets: - config = Config(experimentName = "experiment 2", + config = Config(experimentName = f"experiment {experiment_number}", nameTest= dataset + " test", model="normal", dataset=dataset, lam=0.1, # 0.1 10 - gamma=0, + gamma=0.5, alpha=0.0, learning_rate=0.3, - max_depth=12, + max_depth=8, max_tree=20, - nBuckets=35, + nBuckets=100, save=True, target_rank=1, - data_devision=[0.0125, 0.4875, 0.5], - train_size=2000) - create_table_config_variable("experiment1_targetandshadow", modeltype="FederBoost", + # data_devision=[0.0125, 0.4875, 0.5], + data_devision=[1000/10_000, 9_000/10_000], + train_size=10_000) + create_table_config_variable("experiment2_targetandshadow", modeltype="FederBoost", alpha=config.alpha, gamma=config.gamma, lam=config.lam, learningrate = config.learning_rate, maxdepth = config.max_depth, - maxtree = config.max_tree, + maxtree = config.max_tree, + data_devision = config.data_devision, + nBuckets = config.nBuckets, + train_size = config.train_size ) - central_config_attack= {"max_depth":12, "objective":"binary:logistic", "tree_method=":"approx", + central_config_attack= {"max_depth":12, "objective":"binary:logistic", "tree_method":"approx", "learning_rate":0.3, "n_estimators":20, "gamma":0, "reg_alpha":0.0, "reg_lambda":1} create_table_config_variable("exp2 central attack", modeltype="XGBClassifier", **central_config_attack) @@ -493,7 +525,9 @@ def experiment2(): np.random.RandomState(seed) # TODO set seed sklearn.split - if targetArchitecture == "FederBoost-central": + if targetArchitecture == "FederBoost-Central" or targetArchitecture == "FederBoost-Federated-2": + if targetArchitecture == "FederBoost-Central": + config.target_rank = 0 # make sure when doing central, the target rank is 0 so total train size is tested against target_model = SFXGBoost(config, logger) shadow_model = SFXGBoost(config, logger) # attack_model = MLPClassifier(hidden_layer_sizes=(20,11,11), activation='relu', solver='adam', learning_rate_init=0.01, max_iter=2000) @@ -501,10 +535,10 @@ def experiment2(): data = get_data_attack_centrally(target_model, shadow_model, attack_model, config, logger, targetArchitecture) if rank == PARTY_ID.SERVER: all_data[targetArchitecture][dataset] = data - elif targetArchitecture == "FederBoost-federated": + elif targetArchitecture == "FederBoost-Federated-1": target_model = SFXGBoost(config, logger) - shadow_models = [SFXGBoost(config, logger) for _ in range(100)] # TODO create the amount of shadow models allowed given by datasetretrieval + shadow_models = [SFXGBoost(config, logger) for _ in range(300)] # TODO create the amount of shadow models allowed given by datasetretrieval # attack_models1 = [ [MLPClassifier(hidden_layer_sizes=(300, 100,50,1), activation='relu', solver='adam', learning_rate_init=0.01, max_iter=2000) for l in range(config.max_depth)] for c in range(config.nClasses)] @@ -517,6 +551,7 @@ def experiment2(): if rank == PARTY_ID.SERVER: all_data[targetArchitecture][dataset] = data elif targetArchitecture == "XGBoost" and rank == PARTY_ID.SERVER: # define neural network + config.target_rank = 0 target_model = xgb.XGBClassifier(max_depth=config.max_depth, objective="multi:softmax", tree_method="approx", num_class=config.nClasses, learning_rate=config.learning_rate, n_estimators=config.max_tree, gamma=config.gamma, reg_alpha=config.alpha, reg_lambda=config.lam) shadow_model = xgb.XGBClassifier(max_depth=config.max_depth, objective="multi:softmax", tree_method="approx", num_class=config.nClasses, @@ -540,14 +575,14 @@ def experiment2(): def main(): if len(sys.argv) < 2: - print("Usage: python main.py ") + print("Usage: python main.py ") else: experimentNumber = int(sys.argv[1]) print(f"running experiment {experimentNumber}!") if experimentNumber == 1: experiment1() - elif experimentNumber == 2: - experiment2() + elif experimentNumber == 2 or experimentNumber == 3: + experiment2_3(experimentNumber) if False: dataset = "healthcare" config = Config(experimentName = "experiment 2", diff --git a/tests/testing.py b/tests/testing.py index 69a3c6b..c721d27 100644 --- a/tests/testing.py +++ b/tests/testing.py @@ -13,17 +13,18 @@ from SFXGBoost.common.pickler import save from SFXGBoost.view.table import create_latex_table_1 # var = 9 +gpi = pickle.load(open("Gpi.p", "rb")) + arguments = pickle.load(open("./Saves/arguments.p", "rb")) # create_latex_table_1(all_data=arguments[0], to_be_tested=arguments[1], metrics=arguments[2], name_model=arguments[3], datasets=arguments[4], destination="./Table/experiment_1.txt") -# pickle.dump(var, open("./Saves/kanker.p", 'wb')) # 10,5 works really well. -# shadow = pickle.load(open('Saves/healthcare test_rank_1/healthcare_shadow_model_0.p', 'rb')) -D_train = pickle.load(open('/mnt/scratch_dir/meerhofj/Saves/healthcare test_rank_0/healthcare_D_Train_Attack_0,11.p', 'rb')) +shadow = pickle.load(open('/mnt/scratch_dir/meerhofj/Saves/healthcare test_rank_0/healthcare_shadow_model_1.p', 'rb')) +D_train = pickle.load(open('/mnt/scratch_dir/meerhofj/Saves/healthcare test_rank_0/healthcare_D_Train_Attack_0,3.p', 'rb')) # D_test = pickle.load(open('Saves/healthcare test_rank_0/healthcare_D_test_attack2.p', 'rb')) # tmp = pickle.load(open('Saves/healthcare test_rank_0/healthcare_D_train_attack2.p', 'rb')) -if True: +if False: x = 1 D_train = pickle.load(open('/mnt/scratch_dir/meerhofj/Saves/healthcare test_rank_0/healthcare_D_train_attack2.p', 'rb')) np.column_stack((D_train[0][7], D_train[0][14], D_train[0][21]))