-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
third module: Federated Learning & HE
- Loading branch information
1 parent
c61fe51
commit 4c58d8d
Showing
9 changed files
with
11,910 additions
and
0 deletions.
There are no files selected for viewing
3,191 changes: 3,191 additions & 0 deletions
3,191
3-federated-learning-he/1 Intro to Federated Learning.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
3,499 changes: 3,499 additions & 0 deletions
3,499
3-federated-learning-he/2 Homomorphic Encryption.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
3,624 changes: 3,624 additions & 0 deletions
3,624
3-federated-learning-he/3 Federated Learning and HE.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
120 changes: 120 additions & 0 deletions
120
3-federated-learning-he/Duet/duet_fl/Duet_FL_1_Data_Owner.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "composed-receipt", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import syft as sy" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "continent-climb", | ||
"metadata": {}, | ||
"source": [ | ||
"# Part 1: Launch a Duet Server and upload data" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "parental-classics", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"duet = sy.launch_duet(loopback=True)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "dying-switch", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import torch as th\n", | ||
"import numpy as np" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "focused-error", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"data = th.FloatTensor(np.array([5, 15, 25, 35, 45, 55]).reshape(-1, 1))\n", | ||
"\n", | ||
"data = data.tag(\"DO1 data\")\n", | ||
"data = data.describe(\"Dataset of 6 samples, 1 feature\")\n", | ||
"\n", | ||
"data_ptr = data.send(duet, pointable=True)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "circular-commodity", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"duet.store.pandas" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "undefined-keeping", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"data" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "thousand-borough", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"duet.requests.add_handler(\n", | ||
" action=\"accept\",\n", | ||
" print_local=True, # print the result in your notebook\n", | ||
")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "assigned-tomato", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.11" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
120 changes: 120 additions & 0 deletions
120
3-federated-learning-he/Duet/duet_fl/Duet_FL_2_Data_Owner.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "electric-requirement", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import syft as sy" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "dependent-pharmacy", | ||
"metadata": {}, | ||
"source": [ | ||
"# Part 1: Launch a Duet Server and upload data" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "dirty-subject", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"duet = sy.duet(loopback=True)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "different-setup", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import torch as th\n", | ||
"import numpy as np" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "continent-sixth", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"data = th.FloatTensor(np.array([60, 65, 75, 85, 95]).reshape(-1, 1))\n", | ||
"\n", | ||
"data = data.tag(\"DO2 data\")\n", | ||
"data = data.describe(\"Dataset of 5 samples, 1 feature\")\n", | ||
"\n", | ||
"data_ptr = data.send(duet, pointable=True)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "tropical-addition", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"duet.store.pandas" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "nearby-usage", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"data" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "under-revolution", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"duet.requests.add_handler(\n", | ||
" action=\"accept\",\n", | ||
" print_local=True, # print the result in your notebook\n", | ||
")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "every-banana", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.11" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.