Updates to the codelab.
PiperOrigin-RevId: 318054616
This commit is contained in:
parent
74bd89d754
commit
18fe9eb3aa
1 changed files with 20 additions and 3 deletions
|
@ -135,6 +135,16 @@
|
||||||
"from tensorflow_privacy.privacy.membership_inference_attack import membership_inference_attack as mia"
|
"from tensorflow_privacy.privacy.membership_inference_attack import membership_inference_attack as mia"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {
|
||||||
|
"colab_type": "text",
|
||||||
|
"id": "pBbcG86th_sW"
|
||||||
|
},
|
||||||
|
"source": [
|
||||||
|
"## Train a simple model on CIFAR10 with Keras."
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
|
@ -145,8 +155,6 @@
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"#@title Train a simple model on CIFAR10 with Keras.\n",
|
|
||||||
"\n",
|
|
||||||
"dataset = 'cifar10'\n",
|
"dataset = 'cifar10'\n",
|
||||||
"num_classes = 10\n",
|
"num_classes = 10\n",
|
||||||
"num_conv = 3\n",
|
"num_conv = 3\n",
|
||||||
|
@ -254,6 +262,16 @@
|
||||||
"loss_test = cce(constant(y_test), constant(prob_test), from_logits=False).numpy()"
|
"loss_test = cce(constant(y_test), constant(prob_test), from_logits=False).numpy()"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {
|
||||||
|
"colab_type": "text",
|
||||||
|
"id": "QETxVOHLiHP4"
|
||||||
|
},
|
||||||
|
"source": [
|
||||||
|
"## Run membership inference attacks."
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
|
@ -264,7 +282,6 @@
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"#@title Run membership inference attacks.\n",
|
|
||||||
"#@markdown We will now execute membership inference attack against the\n",
|
"#@markdown We will now execute membership inference attack against the\n",
|
||||||
"#@markdown previously trained CIFAR10 model. This will generate a number of\n",
|
"#@markdown previously trained CIFAR10 model. This will generate a number of\n",
|
||||||
"#@markdown scores (most notably, attacker advantage and AUC for the membership\n",
|
"#@markdown scores (most notably, attacker advantage and AUC for the membership\n",
|
||||||
|
|
Loading…
Reference in a new issue