Browse Source

removing notebooks

Steve Nyemba 6 years ago
parent
commit
111d672d3c

+ 0 - 273
notebooks/.ipynb_checkpoints/risk-checkpoint.ipynb

@@ -1,273 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 66,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import pandas as pd\n",
-    "import numpy as np\n",
-    "from google.cloud import bigquery as bq\n",
-    "\n",
-    "client = bq.Client.from_service_account_json('/home/steve/dev/google-cloud-sdk/accounts/vumc-test.json')"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 33,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "xo = ['person_id','date_of_birth','race']\n",
-    "xi = ['person_id','value_as_number','value_source_value']"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 53,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "def get_tables(client,did,fields=[]):\n",
-    "    \"\"\"\n",
-    "        getting table lists from google\n",
-    "    \"\"\"\n",
-    "    r = []\n",
-    "    ref = client.dataset(id)\n",
-    "    tables = list(client.list_tables(ref))\n",
-    "    for table in tables :\n",
-    "        ref = table.reference\n",
-    "        schema = client.get_table(ref).schema\n",
-    "        names = [f.field_name for f in schema]\n",
-    "        x = list(set(names) & set(fields))\n",
-    "        if x  :\n",
-    "            r.append({\"name\":table.table_id,\"fields\":names})\n",
-    "    return r\n",
-    "    \n",
-    "def get_fields(**args):\n",
-    "    \"\"\"\n",
-    "        This function will generate a random set of fields from two tables. Tables are structured as follows \n",
-    "        {name,fields:[],\"y\":}, with \n",
-    "            name     table name (needed to generate sql query)\n",
-    "            fields   list of field names, used in the projection\n",
-    "            y        name of the field to be joined.\n",
-    "        @param xo candidate table in the join\n",
-    "        @param xi candidate table in the join\n",
-    "        @param join field by which the tables can be joined.\n",
-    "    \"\"\"\n",
-    "    # The set operation will remove redundancies in the field names (not sure it's a good idea)\n",
-    "    xo = args['xo']['fields']\n",
-    "    xi = args['xi']['fields']\n",
-    "    zi = args['xi']['name']\n",
-    "    return list(set(xo) | set(['.'.join([args['xi']['name'],name]) for name in xi if name != args['join']]) )\n",
-    "def generate_sql(**args):\n",
-    "    \"\"\"\n",
-    "        This function will generate the SQL query for the resulting join\n",
-    "    \"\"\"\n",
-    "    xo = args['xo']\n",
-    "    xi = args['xi']\n",
-    "    sql = \"SELECT :fields FROM :xo.name INNER JOIN :xi.name ON :xi.name.:xi.y = :xo.y \"\n",
-    "    fields = \",\".join(get_fields(xo=xi,xi=xi,join=xi['y']))\n",
-    "    \n",
-    "    \n",
-    "    sql = sql.replace(\":fields\",fields).replace(\":xo.name\",xo['name']).replace(\":xi.name\",xi['name'])\n",
-    "    sql = sql.replace(\":xi.y\",xi['y']).replace(\":xo.y\",xo['y'])\n",
-    "    return sql\n",
-    "    \n",
-    "    "
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 54,
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "['person_id',\n",
-       " 'measurements.value_as_number',\n",
-       " 'date_of_birth',\n",
-       " 'race',\n",
-       " 'measurements.value_source_value']"
-      ]
-     },
-     "execution_count": 54,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "xo = {\"name\":\"person\",\"fields\":['person_id','date_of_birth','race']}\n",
-    "xi = {\"name\":\"measurements\",\"fields\":['person_id','value_as_number','value_source_value']}\n",
-    "get_fields(xo=xo,xi=xi,join=\"person_id\")"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 55,
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "'SELECT person_id,value_as_number,measurements.value_source_value,measurements.value_as_number,value_source_value FROM person INNER JOIN measurements ON measurements.person_id = person_id '"
-      ]
-     },
-     "execution_count": 55,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "xo = {\"name\":\"person\",\"fields\":['person_id','date_of_birth','race'],\"y\":\"person_id\"}\n",
-    "xi = {\"name\":\"measurements\",\"fields\":['person_id','value_as_number','value_source_value'],\"y\":\"person_id\"}\n",
-    "generate_sql(xo=xo,xi=xi)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 59,
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "[('a', 'b'), ('a', 'c'), ('b', 'c')]"
-      ]
-     },
-     "execution_count": 59,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "\"\"\"\n",
-    "    We are designing a process that will take two tables that will generate \n",
-    "\"\"\"\n",
-    "import itertools\n",
-    "list(itertools.combinations(['a','b','c'],2))"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 87,
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "TableReference(DatasetReference(u'aou-res-deid-vumc-test', u'raw'), 'care_site')"
-      ]
-     },
-     "execution_count": 87,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "ref = client.dataset('raw')\n",
-    "tables = list(client.list_tables(ref))\n",
-    "names = [table.table_id for table in tables]\n",
-    "(tables[0].reference)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 85,
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "(u'care_site',\n",
-       " u'concept',\n",
-       " u'concept_ancestor',\n",
-       " u'concept_class',\n",
-       " u'concept_relationship',\n",
-       " u'concept_synonym',\n",
-       " u'condition_occurrence',\n",
-       " u'criteria',\n",
-       " u'death',\n",
-       " u'device_exposure',\n",
-       " u'domain',\n",
-       " u'drug_exposure',\n",
-       " u'drug_strength',\n",
-       " u'location',\n",
-       " u'measurement',\n",
-       " u'note',\n",
-       " u'observation',\n",
-       " u'people_seed',\n",
-       " u'person',\n",
-       " u'procedure_occurrence',\n",
-       " u'relationship',\n",
-       " u'visit_occurrence',\n",
-       " u'vocabulary')"
-      ]
-     },
-     "execution_count": 85,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "#\n",
-    "# find every table with person id at the very least or a subset of fields\n",
-    "#\n",
-    "def get_tables\n",
-    "q = ['person_id']\n",
-    "pairs = list(itertools.combinations(names,len(names)))\n",
-    "pairs[0]"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 90,
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "['a']"
-      ]
-     },
-     "execution_count": 90,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "list(set(['a','b']) & set(['a']))"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": []
-  }
- ],
- "metadata": {
-  "kernelspec": {
-   "display_name": "Python 2",
-   "language": "python",
-   "name": "python2"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 2
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython2",
-   "version": "2.7.15rc1"
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}

+ 0 - 238
notebooks/Untitled.ipynb

@@ -1,238 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 1,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import itertools \n",
-    "import pandas as pd\n",
-    "import numpy as np\n",
-    "# from pandas_risk import *\n",
-    "from time import time\n",
-    "import os\n",
-    "\n",
-    "attr = ['gender','race','zip','year_of_birth']\n",
-    "comb_attr = [\n",
-    "    ['zip' ,'gender', 'birth_datetime', 'race'], \n",
-    "    ['zip', 'gender', 'year_of_birth', 'race'], \n",
-    "    ['gender','race','zip'],\n",
-    "    ['race','year_of_birth','zip']\n",
-    "]\n",
-    "    "
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 2,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "SQL_CONTROLLED=\"SELECT * FROM deid_risk.basic_risk60k\"\n",
-    "dfc = pd.read_gbq(SQL_CONTROLLED,private_key='/home/steve/dev/google-cloud-sdk/accounts/curation-test.json')\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 3,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "def risk(**args):\n",
-    "    Yi    = args['data']\n",
-    "    Yi    = Yi.fillna(' ')\n",
-    "    sizes = args['prop'] if 'prop' in args else np.arange(5,100,5)\n",
-    "    FLAG  = args['flag'] if 'flag' in args else 'UNFLAGGED'\n",
-    "    N     = args['num_runs']\n",
-    "    if 'cols' in args :\n",
-    "        columns = args['cols']\n",
-    "    else:\n",
-    "        columns = list(set(Yi.columns.tolist()) - set(['person_id']))\n",
-    "    p     = pd.DataFrame()\n",
-    "    y_i= pd.DataFrame({\"group_size\":Yi.groupby(columns,as_index=False).size()}).reset_index()\n",
-    "    for index in sizes :\n",
-    "        for n in np.repeat(index,N):\n",
-    "        \n",
-    "             # we will randomly sample n% rows from the dataset\n",
-    "            i = np.random.choice(Yi.shape[0],((Yi.shape[0] * n)/100),replace=False)\n",
-    "            x_i= pd.DataFrame(Yi).loc[i] \n",
-    "            risk = x_i.deid.risk(id='person_id',quasi_id = columns)\n",
-    "            x_i = pd.DataFrame({\"group_size\":x_i.groupby(columns,as_index=False).size()}).reset_index()\n",
-    "\n",
-    "\n",
-    "            r = pd.merge(x_i,y_i,on=columns,how='inner')\n",
-    "            if r.shape[0] == 0 :\n",
-    "                continue\n",
-    "            r['marketer'] = r.apply(lambda row: (row.group_size_x / np.float64(row.group_size_y)) /np.sum(x_i.group_size) ,axis=1)\n",
-    "            r['sample %'] = np.repeat(n,r.shape[0])\n",
-    "            r['tier'] = np.repeat(FLAG,r.shape[0])\n",
-    "            r['sample marketer'] =  np.repeat(risk['marketer'].values[0],r.shape[0])\n",
-    "    #         r['patient_count'] = np.repeat(r.shape[0],r.shape[0])\n",
-    "            r = r.groupby(['sample %','tier','sample marketer'],as_index=False).sum()[['sample %','marketer','sample marketer','tier']]\n",
-    "            p = p.append(r)\n",
-    "            p.index = np.arange(p.shape[0]).astype(np.int64)\n",
-    "    return p\n",
-    "   \n",
-    "    "
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 4,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "from pandas_risk import *\n",
-    "o = pd.DataFrame()\n",
-    "PATH=\"out/experiment-phase-2.xlsx\"\n",
-    "writer = pd.ExcelWriter(PATH,engine='xlsxwriter')\n",
-    "comb_attr = [\n",
-    "    ['zip' ,'gender', 'birth_datetime', 'race'], \n",
-    "    ['zip', 'gender', 'year_of_birth', 'race'], \n",
-    "    ['gender','race','zip'],\n",
-    "    ['race','year_of_birth','zip']\n",
-    "]\n",
-    "\n",
-    "for cols in comb_attr :\n",
-    "    o = risk(data=dfc,cols=cols,flag='CONTROLLED',num_runs=5)\n",
-    "    #\n",
-    "    # adding the policy\n",
-    "    x = [1* dfc.columns.isin(cols) for i in range(o.shape[0])]\n",
-    "    o = o.join(pd.DataFrame(x,columns = dfc.columns))\n",
-    "    #\n",
-    "    # Write this to excel notebook\n",
-    "    o.to_excel(writer,\"-\".join(cols))\n",
-    "#     break\n",
-    "    \n",
-    "\n",
-    "# p = p.rename(columns={'marketer_x':'sample marketer'})\n",
-    "# p.index = np.arange(p.shape[0]).astype(np.int64)\n",
-    "\n",
-    "writer.save()"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 20,
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/html": [
-       "<div>\n",
-       "<style scoped>\n",
-       "    .dataframe tbody tr th:only-of-type {\n",
-       "        vertical-align: middle;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe tbody tr th {\n",
-       "        vertical-align: top;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe thead th {\n",
-       "        text-align: right;\n",
-       "    }\n",
-       "</style>\n",
-       "<table border=\"1\" class=\"dataframe\">\n",
-       "  <thead>\n",
-       "    <tr style=\"text-align: right;\">\n",
-       "      <th></th>\n",
-       "      <th>person_id</th>\n",
-       "      <th>year_of_birth</th>\n",
-       "      <th>month_of_birth</th>\n",
-       "      <th>day_of_birth</th>\n",
-       "      <th>birth_datetime</th>\n",
-       "      <th>race_concept_id</th>\n",
-       "      <th>ethnicity_concept_id</th>\n",
-       "      <th>location_id</th>\n",
-       "      <th>care_site_id</th>\n",
-       "      <th>person_source_value</th>\n",
-       "      <th>...</th>\n",
-       "      <th>gender_source_concept_id</th>\n",
-       "      <th>race_source_value</th>\n",
-       "      <th>ethnicity_source_value</th>\n",
-       "      <th>sex_at_birth</th>\n",
-       "      <th>birth_date</th>\n",
-       "      <th>race</th>\n",
-       "      <th>zip</th>\n",
-       "      <th>city</th>\n",
-       "      <th>state</th>\n",
-       "      <th>gender</th>\n",
-       "    </tr>\n",
-       "  </thead>\n",
-       "  <tbody>\n",
-       "  </tbody>\n",
-       "</table>\n",
-       "<p>0 rows × 21 columns</p>\n",
-       "</div>"
-      ],
-      "text/plain": [
-       "Empty DataFrame\n",
-       "Columns: [person_id, year_of_birth, month_of_birth, day_of_birth, birth_datetime, race_concept_id, ethnicity_concept_id, location_id, care_site_id, person_source_value, gender_source_value, gender_source_concept_id, race_source_value, ethnicity_source_value, sex_at_birth, birth_date, race, zip, city, state, gender]\n",
-       "Index: []\n",
-       "\n",
-       "[0 rows x 21 columns]"
-      ]
-     },
-     "execution_count": 20,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "x = [1* dfc.columns.isin(cols) for i in range(o.shape[0])]\n",
-    "o.join(pd.DataFrame(x,columns = dfc.columns))\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 6,
-   "metadata": {},
-   "outputs": [
-    {
-     "ename": "NameError",
-     "evalue": "name 'columns' is not defined",
-     "output_type": "error",
-     "traceback": [
-      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
-      "\u001b[0;31mNameError\u001b[0m                                 Traceback (most recent call last)",
-      "\u001b[0;32m<ipython-input-6-8e7b9895361f>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mcolumns\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
-      "\u001b[0;31mNameError\u001b[0m: name 'columns' is not defined"
-     ]
-    }
-   ],
-   "source": [
-    "columns\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": []
-  }
- ],
- "metadata": {
-  "kernelspec": {
-   "display_name": "Python 2",
-   "language": "python",
-   "name": "python2"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 2
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython2",
-   "version": "2.7.15rc1"
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}

File diff suppressed because it is too large
+ 0 - 214
notebooks/data-analysis.ipynb


File diff suppressed because it is too large
+ 0 - 95
notebooks/data-preparation.ipynb


File diff suppressed because it is too large
+ 0 - 610
notebooks/experiments.ipynb


File diff suppressed because it is too large
+ 0 - 385
notebooks/registered-tier-history.ipynb


File diff suppressed because it is too large
+ 0 - 859
notebooks/registered-tier.ipynb


+ 0 - 293
notebooks/risk.ipynb

@@ -1,293 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 4,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "\"\"\"\n",
-    "    This notebook is intended to show how to use the risk framework:\n",
-    "    There are two basic usages:\n",
-    "        1. Experiment\n",
-    "            \n",
-    "            Here the framework will select a number of random fields other than the patient id and compute risk for the selection.\n",
-    "            This will repeat over a designated number of runs.\n",
-    "            \n",
-    "            The parameters to pass to enable this mode are id=<patient id>,nun_runs=<number of runs>\n",
-    "        2. Assessment\n",
-    "        \n",
-    "            Here the framework assumes you are only interested in a list of quasi identifiers and will run the evaluation once for a given list of quasi identifiers.\n",
-    "            The parameters to enable this mode are id=<patient id>,quasi_id=<list of quasi ids>\n",
-    "\"\"\"\n",
-    "import os\n",
-    "import pandas as pd\n",
-    "import numpy as np\n",
-    "\n",
-    "\n",
-    "#\n",
-    "#-- Loading a template file\n",
-    "# The example taken a de-identification white-paper\n",
-    "# http://www.ehealthinformation.ca/wp-content/uploads/2014/08/2009-De-identification-PA-whitepaper1.pdf\n",
-    "#\n",
-    "\n",
-    "import pandas as pd\n",
-    "import numpy as np\n",
-    "from io import StringIO\n",
-    "csv = \"\"\"\n",
-    "id,sex,age,profession,drug_test\n",
-    "1,M,37,doctor,-\n",
-    "2,F,28,doctor,+\n",
-    "3,M,37,doctor,-\n",
-    "4,M,28,doctor,+\n",
-    "5,M,28,doctor,-\n",
-    "6,M,37,doctor,-\n",
-    "\"\"\"\n",
-    "f = StringIO()\n",
-    "f.write(unicode(csv))\n",
-    "f.seek(0)\n",
-    "MY_DATAFRAME = pd.read_csv(f)   "
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 2,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "\"\"\"\n",
-    "    Here's the pandas_risk code verbatim. \n",
-    "    NOTE: \n",
-    "\"\"\"\n",
-    "@pd.api.extensions.register_dataframe_accessor(\"deid\")\n",
-    "class deid :\n",
-    "    \"\"\"\n",
-    "        This class is a deidentification class that will compute risk (marketer, prosecutor) given a pandas dataframe\n",
-    "    \"\"\"\n",
-    "    def __init__(self,df):\n",
-    "        self._df = df\n",
-    "    \n",
-    "    def risk(self,**args):\n",
-    "        \"\"\"\n",
-    "            @param  id          name of patient field            \n",
-    "            @params num_runs    number of runs (default will be 100)\n",
-    "            @params quasi_id \tlist of quasi identifiers to be used (this will only perform a single run)\n",
-    "        \"\"\"\n",
-    "        \n",
-    "        id  = args['id']\n",
-    "        if 'quasi_id' in args :\n",
-    "            num_runs = 1\n",
-    "            columns = list(set(args['quasi_id'])- set(id) )\n",
-    "        else :\n",
-    "            num_runs  = args['num_runs'] if 'num_runs' in args else 100\n",
-    "            columns = list(set(self._df.columns) - set([id]))\n",
-    "        r   = pd.DataFrame()        \n",
-    "        k = len(columns)\n",
-    "        for i in range(0,num_runs) :\n",
-    "            #\n",
-    "            # let's chose a random number of columns and compute marketer and prosecutor risk\n",
-    "            # Once the fields are selected we run a groupby clause\n",
-    "            #\n",
-    "            if 'quasi_id' not in args :\n",
-    "                n   = np.random.randint(2,k) #-- number of random fields we are picking\n",
-    "                ii = np.random.choice(k,n,replace=False)\n",
-    "                cols = np.array(columns)[ii].tolist()\n",
-    "            else:\n",
-    "                cols \t= columns\n",
-    "                n \t= len(cols)\n",
-    "            x_ = self._df.groupby(cols).count()[id].values\n",
-    "            r = r.append(\n",
-    "                pd.DataFrame(\n",
-    "                    [\n",
-    "                        {\n",
-    "                            \"selected\":n,\n",
-    "                            \"marketer\": x_.size / np.float64(np.sum(x_)),\n",
-    "                            \"prosecutor\":1 / np.float64(np.min(x_))\n",
-    "\n",
-    "                        }\n",
-    "                    ]\n",
-    "                )\n",
-    "            )\n",
-    "            g_size = x_.size\n",
-    "            n_ids = np.float64(np.sum(x_))\n",
-    "\n",
-    "        return r"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 7,
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/html": [
-       "<div>\n",
-       "<style scoped>\n",
-       "    .dataframe tbody tr th:only-of-type {\n",
-       "        vertical-align: middle;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe tbody tr th {\n",
-       "        vertical-align: top;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe thead th {\n",
-       "        text-align: right;\n",
-       "    }\n",
-       "</style>\n",
-       "<table border=\"1\" class=\"dataframe\">\n",
-       "  <thead>\n",
-       "    <tr style=\"text-align: right;\">\n",
-       "      <th></th>\n",
-       "      <th>marketer</th>\n",
-       "      <th>prosecutor</th>\n",
-       "      <th>selected</th>\n",
-       "    </tr>\n",
-       "  </thead>\n",
-       "  <tbody>\n",
-       "    <tr>\n",
-       "      <th>0</th>\n",
-       "      <td>0.500000</td>\n",
-       "      <td>1.0</td>\n",
-       "      <td>2</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>0</th>\n",
-       "      <td>0.500000</td>\n",
-       "      <td>1.0</td>\n",
-       "      <td>3</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>0</th>\n",
-       "      <td>0.500000</td>\n",
-       "      <td>1.0</td>\n",
-       "      <td>3</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>0</th>\n",
-       "      <td>0.333333</td>\n",
-       "      <td>1.0</td>\n",
-       "      <td>2</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>0</th>\n",
-       "      <td>0.333333</td>\n",
-       "      <td>0.5</td>\n",
-       "      <td>2</td>\n",
-       "    </tr>\n",
-       "  </tbody>\n",
-       "</table>\n",
-       "</div>"
-      ],
-      "text/plain": [
-       "   marketer  prosecutor  selected\n",
-       "0  0.500000         1.0         2\n",
-       "0  0.500000         1.0         3\n",
-       "0  0.500000         1.0         3\n",
-       "0  0.333333         1.0         2\n",
-       "0  0.333333         0.5         2"
-      ]
-     },
-     "execution_count": 7,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "#\n",
-    "# Lets us compute risk here for a random any random selection of quasi identifiers\n",
-    "# We will run this experiment 5 times\n",
-    "#\n",
-    "MY_DATAFRAME.deid.risk(id='id',num_runs=5)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 8,
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/html": [
-       "<div>\n",
-       "<style scoped>\n",
-       "    .dataframe tbody tr th:only-of-type {\n",
-       "        vertical-align: middle;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe tbody tr th {\n",
-       "        vertical-align: top;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe thead th {\n",
-       "        text-align: right;\n",
-       "    }\n",
-       "</style>\n",
-       "<table border=\"1\" class=\"dataframe\">\n",
-       "  <thead>\n",
-       "    <tr style=\"text-align: right;\">\n",
-       "      <th></th>\n",
-       "      <th>marketer</th>\n",
-       "      <th>prosecutor</th>\n",
-       "      <th>selected</th>\n",
-       "    </tr>\n",
-       "  </thead>\n",
-       "  <tbody>\n",
-       "    <tr>\n",
-       "      <th>0</th>\n",
-       "      <td>0.5</td>\n",
-       "      <td>1.0</td>\n",
-       "      <td>3</td>\n",
-       "    </tr>\n",
-       "  </tbody>\n",
-       "</table>\n",
-       "</div>"
-      ],
-      "text/plain": [
-       "   marketer  prosecutor  selected\n",
-       "0       0.5         1.0         3"
-      ]
-     },
-     "execution_count": 8,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "#\n",
-    "# In this scenario we are just interested in sex,profession,age\n",
-    "#\n",
-    "MY_DATAFRAME.deid.risk(id='id',quasi_id=['age','sex','profession'])"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": []
-  }
- ],
- "metadata": {
-  "kernelspec": {
-   "display_name": "Python 2",
-   "language": "python",
-   "name": "python2"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 2
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython2",
-   "version": "2.7.15rc1"
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}