Switch to side-by-side view

--- a
+++ b/examples/CVTMLE_example.ipynb
@@ -0,0 +1,119 @@
+{
+ "cells": [
+  {
+   "cell_type": "code",
+   "execution_count": 3,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "import sys\n",
+    "import os\n",
+    "sys.path.insert(0, '/home/rnshishir/deepmed/TBEHRT_pl/')\n",
+    "\n",
+    "import scipy\n",
+    "import pandas as pd\n",
+    "import numpy as np\n",
+    "from src.CV_TMLE import *"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "# CV TMLE tutorial"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 4,
+   "metadata": {},
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "running CV-TMLE for binary outcomes...\n"
+     ]
+    }
+   ],
+   "source": [
+    "# folds in the npz format\n",
+    "foldNPZ = ['TBEHRT_Test__CUT0.npz', 'TBEHRT_Test__CUT1.npz', 'TBEHRT_Test__CUT2.npz', 'TBEHRT_Test__CUT3.npz', 'TBEHRT_Test__CUT4.npz' ]\n",
+    "\n",
+    "# cvtmle runner \n",
+    "TMLErun = CVTMLE(fromFolds=foldNPZ,truncate_level=0.03 )\n",
+    "\n",
+    "# estiamte the risk ratio for binary outcome\n",
+    "est = TMLErun.run_tmle_binary()"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 5,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "[0.10878099048487283, 5.2854239704810925e-08, 223885.61366048577]"
+      ]
+     },
+     "execution_count": 5,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "est\n",
+    "# prints estimate and lower and upper conf interval bounds"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 7,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "data = pd.read_parquet('test.parquet')"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 11,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "# raw\n",
+    "# data[data.explabel ==1].label.mean()/data[data.explabel ==0].label.mean()"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": []
+  }
+ ],
+ "metadata": {
+  "kernelspec": {
+   "display_name": "real3",
+   "language": "python",
+   "name": "py3"
+  },
+  "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.6.8"
+  }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 4
+}