Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove mapping from the tutorial
  • Loading branch information
gusmith committed Nov 1, 2019
commit 4cab4e627560c97250d477526e5278b306b74915
181 changes: 87 additions & 94 deletions docs/tutorial/Record Linkage API.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Testing anonlink-entity-service hosted at https://testing.es.data61.xyz/api/v1/\n"
]
],
"output_type": "stream"
}
],
"source": [
Expand All @@ -93,13 +93,11 @@
"outputs": [
{
"data": {
"text/plain": [
"{'project_count': 2278, 'rate': 3863861, 'status': 'ok'}"
]
"text/plain": "{'project_count': 7871, 'rate': 301990, 'status': 'ok'}"
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result",
"execution_count": 3
}
],
"source": [
Expand Down Expand Up @@ -150,7 +148,11 @@
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"metadata": {
"pycharm": {
"is_executing": false
}
},
"outputs": [],
"source": [
"with open('a.csv', 'w') as a_csv:\n",
Expand Down Expand Up @@ -237,11 +239,18 @@
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"generating CLKs: 100%|██████████| 5.00k/5.00k [00:02<00:00, 1.78kclk/s, mean=645, std=43.8]\n",
"generating CLKs: 100%|██████████| 5.00k/5.00k [00:02<00:00, 1.35kclk/s, mean=634, std=50.3]\n"
]
"\rgenerating CLKs: 0%| | 0.00/5.00k [00:00<?, ?clk/s, mean=0, std=0]",
"\rgenerating CLKs: 4%|▍ | 200/5.00k [00:00<00:07, 682clk/s, mean=643, std=44.8]",
"\rgenerating CLKs: 52%|█████▏ | 2.60k/5.00k [00:00<00:02, 959clk/s, mean=643, std=45.7]",
"\rgenerating CLKs: 100%|██████████| 5.00k/5.00k [00:00<00:00, 9.71kclk/s, mean=644, std=45.4]",
"\n\rgenerating CLKs: 0%| | 0.00/5.00k [00:00<?, ?clk/s, mean=0, std=0]",
"\rgenerating CLKs: 4%|▍ | 200/5.00k [00:00<00:04, 1.12kclk/s, mean=625, std=57.3]",
"\rgenerating CLKs: 52%|█████▏ | 2.60k/5.00k [00:00<00:01, 1.56kclk/s, mean=632, std=52.9]",
"\rgenerating CLKs: 100%|██████████| 5.00k/5.00k [00:00<00:00, 12.4kclk/s, mean=632, std=53] ",
"\n"
],
"output_type": "stream"
}
],
"source": [
Expand Down Expand Up @@ -275,22 +284,17 @@
"outputs": [
{
"data": {
"text/plain": [
"{'project_id': 'e98ababc1a02a4057a13b39c846e9f219acf71bd0a4143c7',\n",
" 'result_token': '693c423c0c021f92a9f7b1658ef8f19beaa7b9c1b27ea22c',\n",
" 'update_tokens': ['57401d6c0edfa78abf3bd4a87936159f8c974f93dc352d21',\n",
" '8c44139db950ca88f58f18d18e219f001fa105543a7b25e6']}"
]
"text/plain": "{'project_id': '0989ebe812ab245b3639c2ffae0ac82a9e6efb97d32f3a1f',\n 'result_token': '29687113baf41a7947d049e52f7804ca77fbba0abd243931',\n 'update_tokens': ['0d2321c208a03af044074ac4131ebc795ecb5516749b34d1',\n '55cb5f601fb982ae33dbe4ba27c625fd32f37b08ae410dff']}"
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result",
"execution_count": 9
}
],
"source": [
"project_spec = {\n",
" \"schema\": {},\n",
" \"result_type\": \"mapping\",\n",
" \"result_type\": \"groups\",\n",
" \"number_parties\": 2,\n",
" \"name\": \"API Tutorial Test\"\n",
"}\n",
Expand All @@ -315,24 +319,19 @@
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"metadata": {
"pycharm": {
"is_executing": false
}
},
"outputs": [
{
"data": {
"text/plain": [
"{'error': False,\n",
" 'name': 'API Tutorial Test',\n",
" 'notes': '',\n",
" 'number_parties': 2,\n",
" 'parties_contributed': 0,\n",
" 'project_id': 'e98ababc1a02a4057a13b39c846e9f219acf71bd0a4143c7',\n",
" 'result_type': 'mapping',\n",
" 'schema': {}}"
]
"text/plain": "{'error': False,\n 'name': 'API Tutorial Test',\n 'notes': '',\n 'number_parties': 2,\n 'parties_contributed': 0,\n 'project_id': '0989ebe812ab245b3639c2ffae0ac82a9e6efb97d32f3a1f',\n 'result_type': 'groups',\n 'schema': {}}"
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result",
"execution_count": 10
}
],
"source": [
Expand Down Expand Up @@ -360,7 +359,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 11,
"metadata": {
"pycharm": {
"is_executing": false
Expand All @@ -377,8 +376,12 @@
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"execution_count": 12,
"metadata": {
"pycharm": {
"is_executing": false
}
},
"outputs": [],
"source": [
"b_response = requests.post(\n",
Expand Down Expand Up @@ -410,7 +413,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 13,
"metadata": {
"pycharm": {
"is_executing": false
Expand All @@ -430,8 +433,12 @@
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"execution_count": 14,
"metadata": {
"pycharm": {
"is_executing": false
}
},
"outputs": [],
"source": [
"run_id = run_response['run_id']"
Expand All @@ -446,26 +453,20 @@
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"execution_count": 15,
"metadata": {
"pycharm": {
"is_executing": false
}
},
"outputs": [
{
"data": {
"text/plain": [
"{'current_stage': {'description': 'compute similarity scores',\n",
" 'number': 2,\n",
" 'progress': {'absolute': 25000000,\n",
" 'description': 'number of already computed similarity scores',\n",
" 'relative': 1.0}},\n",
" 'stages': 3,\n",
" 'state': 'running',\n",
" 'time_added': '2019-04-30T12:18:44.633541+00:00',\n",
" 'time_started': '2019-04-30T12:18:44.778142+00:00'}"
]
"text/plain": "{'current_stage': {'description': 'compute output', 'number': 3},\n 'stages': 3,\n 'state': 'completed',\n 'time_added': '2019-11-01T02:39:19.310376+00:00',\n 'time_completed': '2019-11-01T02:39:20.389791+00:00',\n 'time_started': '2019-11-01T02:39:19.336674+00:00'}"
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result",
"execution_count": 15
}
],
"source": [
Expand All @@ -490,7 +491,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 16,
"metadata": {
"pycharm": {
"is_executing": false
Expand All @@ -499,11 +500,10 @@
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"State: completed\n",
"Stage (3/3): compute output\n"
]
"State: completed\nStage (3/3): compute output\n"
],
"output_type": "stream"
}
],
"source": [
Expand All @@ -515,9 +515,11 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 17,
"metadata": {
"pycharm": {}
"pycharm": {
"is_executing": false
}
},
"outputs": [],
"source": [
Expand All @@ -539,7 +541,7 @@
},
{
"cell_type": "code",
"execution_count": 30,
"execution_count": 21,
"metadata": {
"pycharm": {
"is_executing": false
Expand All @@ -548,25 +550,16 @@
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"a[0] maps to b[1449]\n",
"a[1] maps to b[2750]\n",
"a[2] maps to b[4656]\n",
"a[3] maps to b[4119]\n",
"a[4] maps to b[3306]\n",
"a[5] maps to b[2305]\n",
"a[6] maps to b[3944]\n",
"a[7] maps to b[992]\n",
"a[8] maps to b[4612]\n",
"a[9] maps to b[3629]\n",
"...\n"
]
"a[1859] maps to b[3906]\na[950] maps to b[3115]\na[3466] maps to b[3210]\na[1006] maps to b[3452]\na[2325] maps to b[3248]\na[2291] maps to b[687]\na[2144] maps to b[1101]\na[1768] maps to b[3890]\na[1307] maps to b[2441]\na[2932] maps to b[3006]\n...\n"
],
"output_type": "stream"
}
],
"source": [
"for i in range(10):\n",
" print(\"a[{}] maps to b[{}]\".format(i, data['mapping'][str(i)]))\n",
" ((_, a_index), (_, b_index)) = sorted(data['groups'][i])\n",
" print(\"a[{}] maps to b[{}]\".format(a_index, b_index))\n",
"print(\"...\")"
]
},
Expand All @@ -581,7 +574,7 @@
},
{
"cell_type": "code",
"execution_count": 31,
"execution_count": 19,
"metadata": {
"pycharm": {
"is_executing": false
Expand All @@ -590,17 +583,15 @@
"outputs": [
{
"data": {
"text/plain": [
"4853"
]
"text/plain": "4851"
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result",
"execution_count": 19
}
],
"source": [
"len(data['mapping'])"
"len(data['groups'])"
]
},
{
Expand All @@ -614,18 +605,20 @@
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {},
"execution_count": 20,
"metadata": {
"pycharm": {
"is_executing": false
}
},
"outputs": [
{
"data": {
"text/plain": [
"<Response [403]>"
]
"text/plain": "<Response [204]>"
},
"execution_count": 44,
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result",
"execution_count": 20
}
],
"source": [
Expand Down Expand Up @@ -663,13 +656,13 @@
"pycharm": {
"stem_cell": {
"cell_type": "raw",
"source": [],
"metadata": {
"collapsed": false
},
"source": []
}
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}
}