├── README.md ├── XLP_DEMO.ipynb ├── elasticClient.ipynb └── genderAnnotator.ipynb /README.md: -------------------------------------------------------------------------------- 1 | # XLP/NLP Demo 2 | Data used for this presentation can be downloaded for free, upon registration from https://mimic.physionet.org/ 3 | 4 | The full UMLS metathesaurus is available at https://www.nlm.nih.gov/research/umls/licensedcontent/umlsknowledgesources.html 5 | 6 | 7 | Free Notebooks and code for everyone to enjoy... 8 | - genderAnnotator 9 | This is an example of how to create a mahine learned annotator able to discern the gender of the patient in medical notes using a classifier. 10 | 11 | - XLP_DEMO 12 | This is an example of using annotated results to select only interesting concept types and enrich the ontology used by applying word2vec on electronical medical records to find related concepts. It also shows how to use the findings to index and tweak the queries in Elasticsearch. 13 | 14 | - elasticClient 15 | This is a simple Python client for ElasticSearch showing how to do basic CRUD operation on indexes and also how to define custom analyzers to include "synonyms" 16 | 17 | Let us know what you think.... -------------------------------------------------------------------------------- /elasticClient.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "metadata": { 3 | "name": "", 4 | "signature": "sha256:f7b6121a7789acae6cdc320081cb92566f6383bfb87907369a8fb5cced89446d" 5 | }, 6 | "nbformat": 3, 7 | "nbformat_minor": 0, 8 | "worksheets": [ 9 | { 10 | "cells": [ 11 | { 12 | "cell_type": "code", 13 | "collapsed": false, 14 | "input": [ 15 | "import elasticsearch\n", 16 | "import requests\n", 17 | "\n", 18 | "def addDocument(row,indexName,collumns):\n", 19 | " try:\n", 20 | " from elasticsearch import ElasticSearch\n", 21 | " es = ElasticSearch([{'host':'10.0.2.86','port':9200}])\n", 22 | " except Exception as e:\n", 23 | " from elasticsearch import Elasticsearch\n", 24 | " es = Elasticsearch([{'host':'10.0.2.86','port':9200}])\n", 25 | " data={}\n", 26 | " i=-1\n", 27 | " for col in collumns.keys():\n", 28 | " i+=1\n", 29 | " content = row[i]\n", 30 | " if type(content)== list :\n", 31 | " content = ' '.join(row[i])\n", 32 | " data[col]=content\n", 33 | " return es.index(index =indexName, body = data, doc_type ='emr')\n", 34 | " \n", 35 | "class ElasticSearchClient(object):\n", 36 | " def __init__(self):\n", 37 | " self.ip = '10.0.2.86'\n", 38 | " self.port = 9200\n", 39 | " self.es = elasticsearch.Elasticsearch([{'host': self.ip, 'port': self.port}]) \n", 40 | " \n", 41 | " def get_indexes(self):\n", 42 | " return self.es.indices.get_aliases().keys()\n", 43 | " \n", 44 | " def create_index(self,indexName='default', shards=1, replicas=0, synonyms=[',']):\n", 45 | " if self.es.indices.exists(indexName):\n", 46 | " print(\"deleting '%s' index...\" % (indexName))\n", 47 | " res = self.es.indices.delete(index = indexName)\n", 48 | " print(\" response: '%s'\" % (res))\n", 49 | " request_body = {\n", 50 | " \"settings\" : {\n", 51 | " \"number_of_shards\": shards,\n", 52 | " \"number_of_replicas\": replicas,\n", 53 | " \"analysis\": {\n", 54 | " \"filter\": {\n", 55 | " \"my_synonym_filter\": {\n", 56 | " \"type\": \"synonym\", \n", 57 | " \"synonyms\": synonyms #[ \"british,english\", \"queen,monarch\"]\n", 58 | " }\n", 59 | " },\n", 60 | " \"analyzer\": {\n", 61 | " \"my_synonyms\": {\n", 62 | " \"tokenizer\": \"standard\",\n", 63 | " \"filter\": [\n", 64 | " \"lowercase\",\n", 65 | " \"my_synonym_filter\" \n", 66 | " ]\n", 67 | " }\n", 68 | " }\n", 69 | " }\n", 70 | " }\n", 71 | " }\n", 72 | " print(\"creating '%s' index...\" %(indexName))\n", 73 | " res = self.es.indices.create(index = indexName, body = request_body)\n", 74 | " print(\" response: '%s'\" % (res))\n", 75 | "\n", 76 | " def delete_index(self, indexName='defualt'):\n", 77 | " if self.es.indices.exists(indexName):\n", 78 | " print(\"deleting '%s' index...\" % (indexName))\n", 79 | " res = self.es.indices.delete(index = indexName)\n", 80 | " print(\" response: '%s'\" % (res)) \n", 81 | " else:\n", 82 | " print 'Index '+indexName+\" doesn't exist yet...\"\n", 83 | " \n", 84 | " def add_documents_from_df(self,indexName='default',df=None):\n", 85 | " header = df.schema.fields\n", 86 | " collumns={}\n", 87 | " for field in header:\n", 88 | " collumns[field.name]={\"type\":\"string\"}\n", 89 | " cnt = df.map(lambda row: addDocument(row,indexName,collumns)).count()\n", 90 | " print 'Processed '+str(cnt)+' rows'\n", 91 | " \n", 92 | " def add_documents_from_files(self,indexName='default',files=None):\n", 93 | " cnt = len(files.first())\n", 94 | " collumns={}\n", 95 | " for i in range(0,cnt):\n", 96 | " collumns['col'+str(i)]={\"type\":\"string\"}\n", 97 | " cnt = files.map(lambda row: addDocument(row,indexName,collumns)).count()\n", 98 | " print 'Processed '+str(cnt)+' rows'" 99 | ], 100 | "language": "python", 101 | "metadata": {}, 102 | "outputs": [], 103 | "prompt_number": 46 104 | }, 105 | { 106 | "cell_type": "heading", 107 | "level": 3, 108 | "metadata": {}, 109 | "source": [ 110 | "Tests/usage examples for ElasticSearchClient" 111 | ] 112 | }, 113 | { 114 | "cell_type": "heading", 115 | "level": 4, 116 | "metadata": {}, 117 | "source": [ 118 | "- create/delete index" 119 | ] 120 | }, 121 | { 122 | "cell_type": "code", 123 | "collapsed": false, 124 | "input": [ 125 | "ec = ElasticSearchClient()\n", 126 | "print ec.get_indexes()\n", 127 | "ec.create_index(indexName='test1',shards=2,replicas=3)\n", 128 | "ec.delete_index(indexName='blabka')\n", 129 | "ec.delete_index(indexName='test1')\n", 130 | "ec.es" 131 | ], 132 | "language": "python", 133 | "metadata": {}, 134 | "outputs": [] 135 | }, 136 | { 137 | "cell_type": "code", 138 | "collapsed": false, 139 | "input": [ 140 | "import pyspark\n", 141 | "import xpatterns.configuration \n", 142 | "from xpatterns.analytics.dal import DAL\n", 143 | "sc = pyspark.SparkContext(master = xpatterns.configuration.XPATTERNS_ANALYTICS_SPARK_MASTER)\n", 144 | "hc = pyspark.sql.HiveContext(sc)\n", 145 | "new_notes = hc.sql(\"select noteid,concepts from strata.tmp_concepts2\")\n", 146 | "new_notes.show()" 147 | ], 148 | "language": "python", 149 | "metadata": {}, 150 | "outputs": [ 151 | { 152 | "output_type": "stream", 153 | "stream": "stdout", 154 | "text": [ 155 | "noteid concepts \n", 156 | "hdfs://10.0.2.85:... ArrayBuffer(sepsi...\n", 157 | "hdfs://10.0.2.85:... ArrayBuffer(q wav...\n", 158 | "hdfs://10.0.2.85:... ArrayBuffer(osteo...\n", 159 | "hdfs://10.0.2.85:... ArrayBuffer(pleur...\n", 160 | "hdfs://10.0.2.85:... ArrayBuffer(fib, ...\n", 161 | "hdfs://10.0.2.85:... ArrayBuffer(antib...\n", 162 | "hdfs://10.0.2.85:... ArrayBuffer(sit, ...\n", 163 | "hdfs://10.0.2.85:... ArrayBuffer(sepsi...\n", 164 | "hdfs://10.0.2.85:... ArrayBuffer(flove...\n", 165 | "hdfs://10.0.2.85:... ArrayBuffer(pleur...\n" 166 | ] 167 | } 168 | ], 169 | "prompt_number": 2 170 | }, 171 | { 172 | "cell_type": "heading", 173 | "level": 4, 174 | "metadata": {}, 175 | "source": [ 176 | "- create index from DataFrame" 177 | ] 178 | }, 179 | { 180 | "cell_type": "code", 181 | "collapsed": false, 182 | "input": [ 183 | "from xpatterns.elasticsearch.elasticsearchclient import ElasticSearchClient\n", 184 | "ec = ElasticSearchClient()\n", 185 | "ec.create_index(indexName='tmp_concepts2',synonyms=['a,b,c,d','a,f,g,h'])\n", 186 | "ec.add_documents_from_df(indexName='tmp_concepts2',df=new_notes)\n", 187 | "#ec.delete_index(indexName='tmp_concepts2')" 188 | ], 189 | "language": "python", 190 | "metadata": {}, 191 | "outputs": [ 192 | { 193 | "output_type": "stream", 194 | "stream": "stdout", 195 | "text": [ 196 | "deleting 'tmp_concepts2' index...\n", 197 | " response: '{u'acknowledged': True}'" 198 | ] 199 | }, 200 | { 201 | "output_type": "stream", 202 | "stream": "stdout", 203 | "text": [ 204 | "\n", 205 | "creating 'tmp_concepts2' index...\n", 206 | " response: '{u'acknowledged': True}'" 207 | ] 208 | }, 209 | { 210 | "output_type": "stream", 211 | "stream": "stdout", 212 | "text": [ 213 | "\n", 214 | "Processed 10 rows" 215 | ] 216 | }, 217 | { 218 | "output_type": "stream", 219 | "stream": "stdout", 220 | "text": [ 221 | "\n" 222 | ] 223 | } 224 | ], 225 | "prompt_number": 55 226 | }, 227 | { 228 | "cell_type": "heading", 229 | "level": 4, 230 | "metadata": {}, 231 | "source": [ 232 | "- create index from text files" 233 | ] 234 | }, 235 | { 236 | "cell_type": "code", 237 | "collapsed": false, 238 | "input": [ 239 | "def normalize(s):\n", 240 | " res = s.lower().replace('.',' ').replace(',',' ').replace(':',' ').replace('_','').replace('*','').replace('|',' ')\n", 241 | " res = res.replace(';',' ').replace('0','').replace('1','').replace('2','').replace('3','').replace('4','').replace('5','')\n", 242 | " res = res.replace('6','').replace('7','').replace('8','').replace('9','').replace('?',' ').replace('@',' ')\n", 243 | " return res\n", 244 | "\n", 245 | "#/user/ubuntu/datasets/demoUser/mimic2-dummy-merged/clean/MIMIC2-merged/\n", 246 | "textfile = sc.textFile('/user/ubuntu/datasets/demoUser/mimic2-dummy-1000notes/clean/*')" 247 | ], 248 | "language": "python", 249 | "metadata": {}, 250 | "outputs": [] 251 | }, 252 | { 253 | "cell_type": "code", 254 | "collapsed": false, 255 | "input": [ 256 | "from xpatterns.elasticsearch.elasticsearchclient import ElasticSearchClient\n", 257 | "ec = ElasticSearchClient()\n", 258 | "rdd = sc.wholeTextFiles('/user/ubuntu/datasets/demoUser/mimic2-dummy-1000notes/clean/')\n", 259 | "ec.create_index(indexName='tmp_concepts_files',synonyms=['a,b,c,d','a,f,g,h'])\n", 260 | "ec.add_documents_from_files(indexName='tmp_conceptsfiles',files=rdd)" 261 | ], 262 | "language": "python", 263 | "metadata": {}, 264 | "outputs": [ 265 | { 266 | "output_type": "stream", 267 | "stream": "stdout", 268 | "text": [ 269 | "deleting 'tmp_concepts_files' index...\n", 270 | " response: '{u'acknowledged': True}'" 271 | ] 272 | }, 273 | { 274 | "output_type": "stream", 275 | "stream": "stdout", 276 | "text": [ 277 | "\n", 278 | "creating 'tmp_concepts_files' index...\n", 279 | " response: '{u'acknowledged': True}'" 280 | ] 281 | }, 282 | { 283 | "output_type": "stream", 284 | "stream": "stdout", 285 | "text": [ 286 | "\n", 287 | "Processed 994 rows" 288 | ] 289 | }, 290 | { 291 | "output_type": "stream", 292 | "stream": "stdout", 293 | "text": [ 294 | "\n" 295 | ] 296 | } 297 | ], 298 | "prompt_number": 53 299 | }, 300 | { 301 | "cell_type": "heading", 302 | "level": 4, 303 | "metadata": {}, 304 | "source": [ 305 | "- search" 306 | ] 307 | }, 308 | { 309 | "cell_type": "code", 310 | "collapsed": false, 311 | "input": [ 312 | "ec.es.search(index='tmp_conceptsfiles', q='sepsis')" 313 | ], 314 | "language": "python", 315 | "metadata": {}, 316 | "outputs": [ 317 | { 318 | "metadata": {}, 319 | "output_type": "pyout", 320 | "prompt_number": 51, 321 | "text": [ 322 | "{u'_shards': {u'failed': 0, u'successful': 5, u'total': 5},\n", 323 | " u'hits': {u'hits': [{u'_id': u'AVTa9jORwVEOLD4U8CAl',\n", 324 | " u'_index': u'tmp_conceptsfiles',\n", 325 | " u'_score': 0.2724844,\n", 326 | " u'_source': {u'col0': u'hdfs://ip-10-0-2-85.ec2.internal:8020/user/ubuntu/datasets/demoUser/mimic2-dummy-1000notes/clean/3325-merged.txt',\n", 327 | " u'col1': u'Neonatology Attending\\nFt infant referred to NICU by Dr. Aleem for sepsis evaluation.\\nInfant born at 39 weeks to 30 yo G4P3 A+, Ab-, GBS+, HBsAg-, RPR-NR woman. Antepartum remarkble for cerclage placement at 19 weeks for h/o cervical incompetence. Admitted in labor. AROM. Received intrapartum antibiotics 2 hours PTD. No maternal fever. HSVD with Apgars 9, 9.\\nExam remarkable for well-appearing term infant in no distress with vital signs as noted, soft AF, nl facies, intact palate, no gfr, clear breath sounds, no murmur, flat soft n-t abdomen without hsm, nl phallus, testes in scrotum, stable hips, nl perfusion, nl tone/activity.\\nTerm asymptomatic newborn with sepsis risk- maternal GBS colonization- partially attenuated by incomplete intrapartum antibiotic prophylaxis. Will check cbc, blood culture. No further evaluation, treatment unless has abnormal cbc, positive blood culture, or development of clinical signs of infection.\\nTo newborn nursery after specimen obtained. In-house coverage by CNS.\\nPrimary provider is Tosha Delarosa GULF SHORES.\\n|\\n|\\nNursing/Sepsis Evaluation\\nInfant is a FT male infant admitted from L&D for sepsis eval. Mom GBS + and received antibx <4hrs PTD. See attending note for complete hx. Admitted to NICU ~1515 w/\\nVS stable. 97.9R, HR 120, RR 60, BP 70/47 x61. CBC/diff and blood cx sent. Baby meds given. LSC/=. No murmur. \\nDS=57. Void x1. Plan to transfer to newborn nursery.\\n'},\n", 328 | " u'_type': u'emr'},\n", 329 | " {u'_id': u'AVTa9jKEwVEOLD4U8B_9',\n", 330 | " u'_index': u'tmp_conceptsfiles',\n", 331 | " u'_score': 0.2724844,\n", 332 | " u'_source': {u'col0': u'hdfs://ip-10-0-2-85.ec2.internal:8020/user/ubuntu/datasets/demoUser/mimic2-dummy-1000notes/clean/3305-merged.txt',\n", 333 | " u'col1': u'|\\nNeonatology NP Triage Note\\nThis is a 37 5-1 week gestation male infant, born by SVD under epirdural anesthesia to a 26 yo G 2 P 12-27 woman\\nPNS: O+/AboRI/RPRNR/HbsAg-/GBS+\\nPregnancy uncomplicated. Mother with history of irregular heart rate=evaulated by cardiology-no intervention.\\nROM 9 minutes PTD. Mother received antibiotics 3 hours PTD. no intrapartum fever or other sepsis risk factors.\\nInfant emerged vigorous. Apgars 9 at one and five minutes\\nPE: vigorous, nondysmorphic infant AFOF, sutures slightly over riding, clavicles intact, palate intact, respirations unlabored, lungs clear/=, RRR, ll/Vl holosystolic murmur across precordium, pink and well perfused, liver edge ar RCM, abdomen soft, nondistended, active bowel sounds, symmetric tone and reflexes, hips stable, spine without dimple.\\nDS 58\\nImp Asymptomatic newborn with sepsis risk\\n Murmur most like transitional\\nPlan CBC with diff, blood culture, no antibiotics unless blood work or clinical presentation suggest sepsis.\\nEvaluate murmur if persists or infant sympromatic.\\nTRansfer to NBN.\\n|\\nNPN\\nBaby boy Turnow was admitted to the NICU for r/o sepsis blood work. ( NNP/MD notes for details). He is active and vigorous, breathing comfortably. VSS. + Murmur audible. A CBC and blood cx were drawn and sent. Baby care was given. D/s was 58. (Infant breast fed in the DR.).\\nP: Sent infant to the regular newborn nursery. Check results of labs.\\n'},\n", 334 | " u'_type': u'emr'},\n", 335 | " {u'_id': u'AVTa9iAhwVEOLD4U8B4x',\n", 336 | " u'_index': u'tmp_conceptsfiles',\n", 337 | " u'_score': 0.27034724,\n", 338 | " u'_source': {u'col0': u'hdfs://ip-10-0-2-85.ec2.internal:8020/user/ubuntu/datasets/demoUser/mimic2-dummy-1000notes/clean/3582-merged.txt',\n", 339 | " u'col1': u\"NICU Admission/TRIAGE Note\\nAsked by Dr. Mcelravy to evaluate this term female for sepsis.\\n2700 gm product of an uncomplicated pregnancy born to a 17 year old G1 P0 woman. EDC 2007-8-14. Prenatal Screens: O+/antibody negative/Rubella immune/RPR non-reactive/HepBSAg negative/GBS negative. Spontaneous onset of labor. Maternal fever to 100.6 in labor, no other sepsis risk factors. IV intrapartum antibiotics started 1 hour prior to delivery. Infant born by SVD, Apgars 9, 9. Admitted to NICU at 1 1/2 hours of life. Color pink in room air; infant non-dysmorphic, alert, vigorous; breath sounds clear/=; no murmur; abdomen soft; 3 vessel cord; normal female genitalia; symmetric tone and reflexes. CBC and blood culutre obtained. Glucose=88.\\nIMPRESSION: well-appearing term infant. Only sepsis risk factor maternal fever.\\nPLAN: Observe infant in Newborn Nursery.\\nIf CBC abnormal, will treat infant with IV antibiotics pending culture results.\\nMother plans to put baby up for adoption. Did not speak with her per wishes of L&D staff who explained sepsis evaluation procedure.\\n|\\n|\\nNeonatology Attending\\nI have reviewed history and examined infant. \\nFull details of history in NNP Buck's note. 2700 gram 37+ week female born to a 17 yo primip with negative PNS including GBS. Planned adoption. Uncomplicated pregnancy. Labor c/b maternal fever only. Received intrapartum antibiotics 1 hr ptd. Vaginal delivery. Apgars 9-1. Sepsis evaluation done and transferred to RN.\\nExam Term AGA female pink and comfortable in RA, AF soft, flat, nondysmorphic, intact palate, clear bs, no murmur, normal pulses, soft abd, no hsm, normal female genitalia, patent anus, no hip click, no sacral dimple, normal tone and activity, MAE\\nHct 64 plt 260 wbc 22.5 (72P/3B/14L/10M/1E)\\nA: Asymptomatic FT AGA female at risk for sepsis secondary to maternal fever. CBC benign.\\nP: Routine care in RN\\n Follow BC results\\n SS involvement\\n|\\nNURSING TRIAGE NOTE\\nINFANT ADMITTED TO NICU FOR SEPSIS EVALUATION. CBC & BLOOD CULTURES DRAWN, D-STICK 88. VSS, BS CL&=, NO AUDIBLE MURMER. COLOR PINK AND WELL PERFUSED. BABY MEDS GIVEN AS ORDERED. TRANSFERED TO NURSERY.\\n\"},\n", 340 | " u'_type': u'emr'},\n", 341 | " {u'_id': u'AVTa9icWwVEOLD4U8B7b',\n", 342 | " u'_index': u'tmp_conceptsfiles',\n", 343 | " u'_score': 0.2641514,\n", 344 | " u'_source': {u'col0': u'hdfs://ip-10-0-2-85.ec2.internal:8020/user/ubuntu/datasets/demoUser/mimic2-dummy-1000notes/clean/3170-merged.txt',\n", 345 | " u'col1': u'Neonatology Attending Admission/Triage Note\\nAsked to evaluate this patient by Dr. Stanojevic for sepsis risk factors. Baby is a 3500gm term male infant delivered at 1649PM today.\\nDelivery was by NSVD. Apgars 9,9. \\nPNS - O pos, Ab neg, HBSAg neg, RPR NR, RI, GBS positive.\\nROM 1 hour and 29 minutes PTD.\\nNo maternal fever noted.\\nMother was treated with antibiotics but only 1 hour and 49 minutes PTD.\\nPE - Baby is well appearing breathing comfortably in RA.\\nVS - T 99.1 HR 148 RR 40 BP 65/34 44\\nHEENT - AF soft and flat, palate intact\\nLungs clear and equal. CVS - no murmur, S1 S2 normal intensity, perfusion good.\\nAbd - soft with normal bowel sounds\\nGU - normal male, testes palpable bilaterally\\nNeuro - tone excellent\\nDS - 55\\nAssessment/plan:\\nWell appearing term male infant with increased risk of GBS sepsis because of maternal colonization.\\nWill check cbc diff and plat and blood culture.\\nWill pursue further work-up and cover with antibiotics if cbc abnormal, any clinical signs of sepsis or cultures positive.\\nParents updated on plans by Mccally, NNP. \\n|\\nAdmission Note\\nBaby boy Browing admitted to NICU from L&D for sepsis eval. Baby was and perfused on arrival. VSS, no resp distress. CBC w/diff and blcx sent. DStick=55. Baby cares given. Plans to transfer infant to Newborn Nursery.\\n|\\n'},\n", 346 | " u'_type': u'emr'},\n", 347 | " {u'_id': u'AVTa9jKHwVEOLD4U8B_-',\n", 348 | " u'_index': u'tmp_conceptsfiles',\n", 349 | " u'_score': 0.2620796,\n", 350 | " u'_source': {u'col0': u'hdfs://ip-10-0-2-85.ec2.internal:8020/user/ubuntu/datasets/demoUser/mimic2-dummy-1000notes/clean/3306-merged.txt',\n", 351 | " u'col1': u'NPN \\nBaby girl Lang was admitted to the NICU for r/o sepsis blood work r/t a maternal temp of 100.4 ( NNP note for details.) Infant is active and alert and BF in L & D (per report). Her diaper appears wet. VSS. A CBC and blood cx were drawn and sent. D/s was 68. Infant has a pustular rash over her upper chest (NNP KS Bellon observed and noted.) Baby care was given.\\nP: Transfer infant to the regular newborn nursery. Check results of labs. \\n|\\nNeonatology NP Note\\nThis is a full term female infant born by SVD under epidural anesthesia to a 31 yo G 4 P 0-1 woman.\\nPNS: O+/Ab-/RI/RPRNR/HbsAg-/GBS-\\nPregnancy remarkable for maternal methylene tetrahydrofolate reductase gene mutation. mother on lovenox until 36 weeks gestation.\\nMaternal intrapartum t max 100.4. No intrapartum antibiotics given. No other sepsis risk factors.\\nInfant emerged vigorous. Apgars 9 at one and five minutes.\\nPE; vigorous, term appearing newborn, AFOF, mild molding, palate intact, ears posteriorly rotated, neck without masses, clavicles intact, respirations unlabored,lungs clear/=, RRl no murmur, pink and well perfused, abdomen soft, nondistended, normal term female genitalia, normal creases and digits, stable hip exam, spine without dimple, symmetric tone and reflexes.\\nImp\\nAsymptomatic newborn with sepsis risk factors\\nPlan\\nCbc with diff, blood cx. No antibiotics unless blood work or clinical presentation suggest sepsis.\\nTRansfer to NBN.\\n|\\n|\\nNeonatology Attending\\nAsked by Dr. Argumedo to evaluate infant for sepsis risk factors.\\nHistory as detailed above by Renita Pagon, NNP. In short, only sepsis risk factor of maternal fever to 100.4. No other risks (negative for GBS, maternal fever, PROM, fetal tachycardia).\\nOn exam: Infant comfortably resting under radiant warmer. +Sig molding, AFSF. Eyes deferred (ointment). Ears normally set. Palate intact. Clavicles intact. Neck supple. Lungs CTA, =. CV RRR, no murmur. Good peripheral pulses. Abd soft, +BS, no masses. Nl female genitalia. Hips stable. No sacral anomalies. Patent anus. Ext pink and well perfused. MAEW. \\nImpression/Plan: Full -term, well-appearing infant being evaluated due to maternal fever. No other sepsis risks. Agree with obtaining CBC w diff and blood cx. Will hold abx for now. Consider if labs abnormal or clinical course changes.\\n'},\n", 352 | " u'_type': u'emr'},\n", 353 | " {u'_id': u'AVTa9hhYwVEOLD4U8B1v',\n", 354 | " u'_index': u'tmp_conceptsfiles',\n", 355 | " u'_score': 0.25841397,\n", 356 | " u'_source': {u'col0': u'hdfs://ip-10-0-2-85.ec2.internal:8020/user/ubuntu/datasets/demoUser/mimic2-dummy-1000notes/clean/3469-merged.txt',\n", 357 | " u'col1': u'Neonatology Attending Triage Note\\nAsked by Dr. Cubbage to evaluate infant for sepsis risk. Infant is a 36 3-29 week, 2775 gm male newborn who was born by cesaren section to a 38 y.o. G1P0 mother. Prenatal screens: O+, antibody negative, HepBsAg negative, RPR NR, RI, GBS unknown. Pregnancy uncomplicated. \\nPresented in spontaneous labor. Maternal Tmax 100.8. No prolonged rupture of membranes. No fetal tachycardia. Intrapartum abx for 11 hours PTD. Cesaren section for \"failure to descend\". Apgars 8,9.\\nOn exam:\\nVS per CareView\\nResting comfortable. AFSF. Small caput. Eyes deferred. Normal set ears. Neck soft and supple. Clavicles intact. Lungs CTA, =. No GFR. CV RRR, no murmur. 2+FP. Abd soft, +BS, no HSM. GU nl male, testes down bilat. Patent anus. No sacral anomalies. Hips stable. Warm, pink and well perfused. Though + acrocyanosis. Nl tone, strength and activity.\\nImpression/Plan:\\nPreterm, AGA male newborn, for sepsis evaluation due to maternal fever and unknown GBS screening. Well-appearing. No other risks identified. Will check CBC w diff and bld cx. Will hold abx unless labs abnormal or clinical status concerning for sepsis. \\nDue to GA< 37 weeks, qualifies for car seat screening prior to discharge from hospital.\\nTo return to NBN once sepsis evaluation complete. pediatrics: Hospital GRANDVIEW Pediatrics, HANNIBAL. \\n|\\n|\\nNPN\\nBaby Gadison admitted to NICU for sepsis evaluation. Vital signs stable upon admission. CBC & BC sent. D/S stable.\\n(Please see flowsheet for details.) Attending MD Alberto\\nKrampitz. Infant transferred back to NBN.\\n'},\n", 358 | " u'_type': u'emr'},\n", 359 | " {u'_id': u'AVTa9h8NwVEOLD4U8B4L',\n", 360 | " u'_index': u'tmp_conceptsfiles',\n", 361 | " u'_score': 0.25841397,\n", 362 | " u'_source': {u'col0': u'hdfs://ip-10-0-2-85.ec2.internal:8020/user/ubuntu/datasets/demoUser/mimic2-dummy-1000notes/clean/3561-merged.txt',\n", 363 | " u'col1': u'NICU Attending Triage Note\\nAgree with above hx, data, PEx, A/KC Mauro Piurkowski. This asx term infant has perinatal risk factors for sepsis (maternal fever to 100.7 - no maternal fever, PROM, GBS-, + intrapartum antibiotic prophylaxis)), PEx benign in detial. Screened for sepsis with CBC and blood cx, WBC 21.1, diff still pending. Will treat with antibiotics only if lab results or clinical course concerning for sepsis.\\n|\\nNPN\\nInfant transferred from L&D for septic w/u- see above note for maternal history. VSS- see carevue. CBC and blood cultures drawn. D stick- 60. Vit K, e-mycin eye ointment given. Infant transferred to 5 nursery. \\n|\\n|\\nNeonatology NP Note\\nThis is a full term female infant born by SVD under epidural anesthesia to a 34 yo G 3 P 12-29 woman.\\nPNS; O-/Ab-/RI/RPRNR/HbsAg-/GBS-\\nPregnancy complicated by thrombocytopenia(?etiology)\\nPeripartum course remarkable for maternal t max 100.7\\nMother received antibiotics 2 1/2 hours PTD.\\nROM 11 hours PTD of MSF.\\nInfant emerged vigorous, apgars 8 at one minute and 9 at five minutes\\nB.W. 2975 grams\\nB.L. 19 inches\\nPE vigorous, nondsymorphic term appearing infant, AFOF, sutures approximated, palate intact, clavicles intact, respirations unlabored, lungs clear/=, RRr, no murmur, pink and well perfused, femoral pulses +2, abdomen soft, nontender and nondistened, normal term female genitalia, stable hip exam, spine straight and without dimple, normal digits and creases, symmetric tone and reflexes, + suck , grasp, and moro.\\nDS 60\\nImp Asymptomatic newborn with sepsis risk\\nPlan CBC with diff, blood c\\nNo antibiotics unless blood work or clinical presentation suggest sepsis.\\nTRansfer to NBN.\\n'},\n", 364 | " u'_type': u'emr'},\n", 365 | " {u'_id': u'AVTa9jLnwVEOLD4U8CAR',\n", 366 | " u'_index': u'tmp_conceptsfiles',\n", 367 | " u'_score': 0.25506857,\n", 368 | " u'_source': {u'col0': u'hdfs://ip-10-0-2-85.ec2.internal:8020/user/ubuntu/datasets/demoUser/mimic2-dummy-1000notes/clean/3837-merged.txt',\n", 369 | " u'col1': u'Neonatology\\nTerm newborn sent to NICU for eval of sepsis risk as manifest by maternal GBS colonixzation in settings of maternal abx rx < 4 h PTD. No other sepsis risk factors. Noted. Prenatal screens complete and unremarkable.\\nOn exam pink active non-dysmorphic. Skinb w/o lesions. HEENT WNL. Cor nl s1s2 w/o murmurs. Abdomen benign. Lungs clear. Hips normal. SPine intact. Neuro non-focal and age appropriate.\\nA- Well apeparing term newborn with slightly increased sepsis risk.\\nP CBC diff BC.\\n No abx unless cbc abnormal or sx develop.\\n Transfer to NN.\\n Parents aware of status and plan.\\n \\n|\\nNursing Note 1350h\\nBaby Bekerman was brought to the NICU for a sepsis evaluation d/t mother GBS pos. status and antibiotics given less than 4hrs. prior to delivery. Infant arrived to NICU pink and vigorous. Temp 98.9R, HR 130, RR 44, BP 87/46 M 60. Infant has stooled. Blood glucose at 2hrs=69. Following glucose protocol for LGA infant. A CBC and Blood culture were sent and are pending. Erythromycin and Vit K given. Parents up to visit, mother held son, plans to breast feed. \\n|\\n'},\n", 370 | " u'_type': u'emr'},\n", 371 | " {u'_id': u'AVTa9iTWwVEOLD4U8B6Y',\n", 372 | " u'_index': u'tmp_conceptsfiles',\n", 373 | " u'_score': 0.251125,\n", 374 | " u'_source': {u'col0': u'hdfs://ip-10-0-2-85.ec2.internal:8020/user/ubuntu/datasets/demoUser/mimic2-dummy-1000notes/clean/3639-merged.txt',\n", 375 | " u'col1': u'|\\nNICU TRIAGE/ADMISSION\\nAsked by Dr. Burlette to evaluate this term female for sepsis.\\n3650 gm product of a term gestation pregnancy born to a 45 year old G7 P2->3 woman. EDC 1982-11-14. Pregnancy reportedly uncomplicated. Prenatal Screens: O-/antibody negative/RPR non-reactive/Rubella immune/HepBSAg negative/GBS positive. ROM less than 24 hours prior to delivery. No maternal fever or other sepsis risk factors. Intrapartum antibiotics less than 4 hours prior to delivery. Meconium stained amniotic fluid. Infant born by SVD, cried at delivery. Apgars 8, 9. Admitted to NICU at 1 1/2 hours of life. Infant vigorous, alert, pink in room air; breath sounds clear/=; no murmur; abdoment full and soft; normal female genitalia; spine intact; symmetric tone and reflexes. CBC and blood culture obtained. Glucose=73.\\nIMPRESSION: well-appearing term female. No sepsis risk factors other than maternal GBS colonization, less that 4 hours intrapartum prophylaxis.\\nPLAN: Observe in Newborn Nusery.\\nIf CBC abnormal, will treat infant with IV antibiotics pending culture results.\\nMother aware of our impression and plan of care.\\nPrimay pediatrician Dr. Isis Weisenborn.\\n|\\nNICU Admit Note\\nBaby girl Hering came to NICU for sepsis evaluation d/t maternal GBS+ and < 4hrs of Abx. Infant with vigorous cry, pink with some facial bruising. VSS. DS 73. CBC with diff and blood culture sent. Newborn meds given. Infant transferred to 6 nursery.\\n'},\n", 376 | " u'_type': u'emr'},\n", 377 | " {u'_id': u'AVTa9jK2wVEOLD4U8CAH',\n", 378 | " u'_index': u'tmp_conceptsfiles',\n", 379 | " u'_score': 0.251125,\n", 380 | " u'_source': {u'col0': u'hdfs://ip-10-0-2-85.ec2.internal:8020/user/ubuntu/datasets/demoUser/mimic2-dummy-1000notes/clean/3312-merged.txt',\n", 381 | " u'col1': u'Neonatology\\nPatient is term newborn sent to NICU for eval of sepsis risk by Dr Norn. Risk manifest by maternal fever to 101 during labor. Received abx 2 h ptd. Mother GBS -, other sepsis risks noted.\\nPrenetal screens complete and unremarkable.\\nOn exam pionk active non-dysmorphic infant. Well perfused and staurated in RA. o skin leisons. Cpor nl s1s2 w/o m. Lungs clear. Comfortable.\\nAbdomen bneign.\\nNeuro non-focal and age appropriate.\\nHips normal. Spine intact. Anus patent.\\nA- well apeparing term infant with inc sepsis risk.\\nP CBC diff BC\\n Abx for 48 h r/o pending cx results and clinical course.\\n Transfer to NN when first dose of abx in\\n Parents aware of status and plan\\n|\\nNursing Note\\nBaby brought to NICU for sepsis eval. Baby meds given. CBC with diff and blood cx done. Heplock started in left foot, flushes easily. 1st dose of Gent and Ampicillin given. Baby stable for transfer to NBN.\\n|\\n'},\n", 382 | " u'_type': u'emr'}],\n", 383 | " u'max_score': 0.2724844,\n", 384 | " u'total': 326},\n", 385 | " u'timed_out': False,\n", 386 | " u'took': 4}" 387 | ] 388 | } 389 | ], 390 | "prompt_number": 51 391 | } 392 | ], 393 | "metadata": {} 394 | } 395 | ] 396 | } -------------------------------------------------------------------------------- /genderAnnotator.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "metadata": { 3 | "name": "", 4 | "signature": "sha256:5b94617cec0c2d8444ac028e186f1a81b933a3606b2c8ee2520f8d4efc94b7de" 5 | }, 6 | "nbformat": 3, 7 | "nbformat_minor": 0, 8 | "worksheets": [ 9 | { 10 | "cells": [ 11 | { 12 | "cell_type": "heading", 13 | "level": 3, 14 | "metadata": {}, 15 | "source": [ 16 | "Setup the python environement and load libraries" 17 | ] 18 | }, 19 | { 20 | "cell_type": "code", 21 | "collapsed": false, 22 | "input": [ 23 | "%matplotlib inline\n", 24 | "import numpy as np\n", 25 | "import datetime\n", 26 | "from pylab import *\n", 27 | "import pandas as pd\n", 28 | "from matplotlib import pyplot as plt\n", 29 | "from matplotlib.ticker import MultipleLocator, FormatStrFormatter\n", 30 | "pd.set_option('display.max_columns', 500)\n", 31 | "pd.set_option('display.width', 1000)\n", 32 | "import pyspark\n", 33 | "import xpatterns.configuration \n", 34 | "from xpatterns.analytics.dal import DAL\n", 35 | "sc = pyspark.SparkContext(master = xpatterns.configuration.XPATTERNS_ANALYTICS_SPARK_MASTER)\n", 36 | "sqc = pyspark.sql.SQLContext(sc)" 37 | ], 38 | "language": "python", 39 | "metadata": {}, 40 | "outputs": [], 41 | "prompt_number": 86 42 | }, 43 | { 44 | "cell_type": "heading", 45 | "level": 3, 46 | "metadata": {}, 47 | "source": [ 48 | "Load the training set (manually labelled MIMIC notes)" 49 | ] 50 | }, 51 | { 52 | "cell_type": "code", 53 | "collapsed": false, 54 | "input": [ 55 | "male = set()\n", 56 | "f = open('male_pts.mimic.txt','r')\n", 57 | "for line in f:\n", 58 | " male.add(line.replace('\\n',''))\n", 59 | "f.close()\n", 60 | "female = set()\n", 61 | "f = open('female_pts.mimic.txt','r')\n", 62 | "for line in f:\n", 63 | " female.add(line.replace('\\n',''))\n", 64 | "f.close()\n", 65 | "def label(row):\n", 66 | " file_name = row[0][row[0].rindex('/')+1:]\n", 67 | " txt = row[1]\n", 68 | " lbl=0\n", 69 | " if file_name in male:\n", 70 | " lbl=1\n", 71 | " return (file_name,txt,lbl)\n", 72 | "\n", 73 | "from pyspark.mllib.feature import IDF\n", 74 | "from pyspark.ml.feature import Tokenizer, HashingTF\n", 75 | "rdd = sc.wholeTextFiles('/user/claudiub/mimic-gender/clean/')\n", 76 | "data_set = rdd.map(lambda x:label(x))\n", 77 | "df = sqc.createDataFrame(data_set,[\"file_name\",\"txt\",\"label\"])\n", 78 | "data_frame = df.toPandas()\n", 79 | "sc.stop()\n", 80 | "data_frame.head(10)" 81 | ], 82 | "language": "python", 83 | "metadata": {}, 84 | "outputs": [ 85 | { 86 | "html": [ 87 | "
\n", 88 | "\n", 89 | " \n", 90 | " \n", 91 | " \n", 92 | " \n", 93 | " \n", 94 | " \n", 95 | " \n", 96 | " \n", 97 | " \n", 98 | " \n", 99 | " \n", 100 | " \n", 101 | " \n", 102 | " \n", 103 | " \n", 104 | " \n", 105 | " \n", 106 | " \n", 107 | " \n", 108 | " \n", 109 | " \n", 110 | " \n", 111 | " \n", 112 | " \n", 113 | " \n", 114 | " \n", 115 | " \n", 116 | " \n", 117 | " \n", 118 | " \n", 119 | " \n", 120 | " \n", 121 | " \n", 122 | " \n", 123 | " \n", 124 | " \n", 125 | " \n", 126 | " \n", 127 | " \n", 128 | " \n", 129 | "
file_nametxtlabel
010045.txt11/06\\n1937-12-15 pt transferred from Hospital...0
110071.txtNeonatology Attending Triage Note:\\nasked by D...1
210252.txtHVMA/NEON DOL 4 CGA 35 12-18\\nRA, no AOP, RR40...0
310284.txtNursing admit/transfer note\\nBB Fiacco brought...1
4103.txt7a-7p:\\nNeuro/Comfort: Sedated. pt lightly se...0
\n", 130 | "
" 131 | ], 132 | "metadata": {}, 133 | "output_type": "pyout", 134 | "prompt_number": 87, 135 | "text": [ 136 | " file_name txt label\n", 137 | "0 10045.txt 11/06\\n1937-12-15 pt transferred from Hospital... 0\n", 138 | "1 10071.txt Neonatology Attending Triage Note:\\nasked by D... 1\n", 139 | "2 10252.txt HVMA/NEON DOL 4 CGA 35 12-18\\nRA, no AOP, RR40... 0\n", 140 | "3 10284.txt Nursing admit/transfer note\\nBB Fiacco brought... 1\n", 141 | "4 103.txt 7a-7p:\\nNeuro/Comfort: Sedated. pt lightly se... 0" 142 | ] 143 | } 144 | ] 145 | }, 146 | { 147 | "cell_type": "heading", 148 | "level": 3, 149 | "metadata": {}, 150 | "source": [ 151 | "Split the dataset into traning and testing pieces (400 notes for training and 100 for testing). Vectorize the text using the HashingVectorizer from scikit-learn and generate 5000 features per note. Select the top 2000 best features by applying chi-squared test between the 5000 features and the labels of the training set." 152 | ] 153 | }, 154 | { 155 | "cell_type": "code", 156 | "collapsed": false, 157 | "input": [ 158 | "from sklearn.feature_extraction.text import TfidfVectorizer\n", 159 | "from sklearn.feature_selection import SelectKBest, chi2\n", 160 | "from sklearn.linear_model import SGDClassifier\n", 161 | "from sklearn.linear_model import Perceptron\n", 162 | "from sklearn.neighbors import KNeighborsClassifier\n", 163 | "from sklearn.ensemble import RandomForestClassifier\n", 164 | "from sklearn import metrics\n", 165 | "from time import time\n", 166 | "\n", 167 | "train_size=400 #out of 500\n", 168 | "x_train = data_frame[:train_size]['txt']\n", 169 | "y_train = data_frame[:train_size]['label']\n", 170 | "x_test = data_frame[train_size:]['txt']\n", 171 | "y_test = data_frame[train_size:]['label']\n", 172 | "\n", 173 | "import xpatterns.analytics.vizualization.viztools as viz\n", 174 | "from xpatterns.analytics.dataframeplus import DataFramePlus\n", 175 | "\n", 176 | "vectorizer = HashingVectorizer(stop_words='english', non_negative=True, n_features=5000)\n", 177 | "X_train = vectorizer.transform(x_train)\n", 178 | "X_test = vectorizer.transform(x_test)\n", 179 | "\n", 180 | "ch2 = SelectKBest(chi2, k=2000)\n", 181 | "X_train = ch2.fit_transform(X_train, y_train)\n", 182 | "X_test = ch2.transform(X_test)" 183 | ], 184 | "language": "python", 185 | "metadata": {}, 186 | "outputs": [], 187 | "prompt_number": 188 188 | }, 189 | { 190 | "cell_type": "heading", 191 | "level": 3, 192 | "metadata": {}, 193 | "source": [ 194 | "Train Perceptron, kNN (Nearest Neighbours), Random Forest and SGD (Stochastic Gradient Descent) classifiers and compare the classification accuracy and the training/scoring times" 195 | ] 196 | }, 197 | { 198 | "cell_type": "code", 199 | "collapsed": false, 200 | "input": [ 201 | "def trim(s):\n", 202 | " \"\"\"Trim string to fit on terminal (assuming 80-column display)\"\"\"\n", 203 | " return s if len(s) <= 190 else s[:187] + \"...\"\n", 204 | "\n", 205 | "categories = ['male','female']\n", 206 | "\n", 207 | "def benchmark(clf):\n", 208 | " print('_' * 120)\n", 209 | " print(\"Training: \")\n", 210 | " print(clf)\n", 211 | " t0 = time()\n", 212 | " clf.fit(X_train, y_train)\n", 213 | " train_time = time() - t0\n", 214 | " print(\"train time: %0.3fs\" % train_time)\n", 215 | "\n", 216 | " t0 = time()\n", 217 | " pred = clf.predict(X_test)\n", 218 | " test_time = time() - t0\n", 219 | " print(\"test time: %0.3fs\" % test_time)\n", 220 | "\n", 221 | " score = metrics.accuracy_score(y_test, pred)\n", 222 | " print(\"accuracy: %0.3f\" % score)\n", 223 | "\n", 224 | " print(\"classification report:\")\n", 225 | " print(metrics.classification_report(y_test, pred, target_names=categories))\n", 226 | " clf_descr = str(clf).split('(')[0]\n", 227 | " return clf_descr, score, train_time, test_time\n", 228 | "\n", 229 | "results = []\n", 230 | "for clf, name in (\n", 231 | " (Perceptron(n_iter=50), \"Perceptron\"),\n", 232 | " (KNeighborsClassifier(n_neighbors=100), \"kNN\"),\n", 233 | " (RandomForestClassifier(n_estimators=100), \"Random forest\"),\n", 234 | " (SGDClassifier(alpha=.0001, n_iter=50),\"SGD\")):\n", 235 | " print('=' * 120)\n", 236 | " print(name)\n", 237 | " results.append(benchmark(clf))\n", 238 | "\n", 239 | "\n", 240 | "indices = np.arange(len(results))\n", 241 | "\n", 242 | "results = [[x[i] for x in results] for i in range(4)]\n", 243 | "\n", 244 | "clf_names, score, training_time, test_time = results\n", 245 | "training_time = np.array(training_time) / np.max(training_time)\n", 246 | "test_time = np.array(test_time) / np.max(test_time)\n", 247 | "\n", 248 | "plt.figure(figsize=(8, 4))\n", 249 | "plt.title(\"Performance\")\n", 250 | "plt.barh(indices, score, .2, label=\"score\", color='r')\n", 251 | "plt.barh(indices + .3, training_time, .2, label=\"training time\", color='g')\n", 252 | "plt.barh(indices + .6, test_time, .2, label=\"test time\", color='b')\n", 253 | "plt.yticks(())\n", 254 | "plt.legend(loc='upper center')\n", 255 | "plt.subplots_adjust(left=.25)\n", 256 | "plt.subplots_adjust(top=.95)\n", 257 | "plt.subplots_adjust(bottom=.05)\n", 258 | "\n", 259 | "for i, c in zip(indices, clf_names):\n", 260 | " plt.text(-.3, i, c)\n", 261 | "\n", 262 | "plt.show()" 263 | ], 264 | "language": "python", 265 | "metadata": {}, 266 | "outputs": [ 267 | { 268 | "output_type": "stream", 269 | "stream": "stdout", 270 | "text": [ 271 | "========================================================================================================================\n", 272 | "Perceptron\n", 273 | "________________________________________________________________________________________________________________________\n", 274 | "Training: \n", 275 | "Perceptron(alpha=0.0001, class_weight=None, eta0=1.0, fit_intercept=True,\n", 276 | " n_iter=50, n_jobs=1, penalty=None, random_state=0, shuffle=True,\n", 277 | " verbose=0, warm_start=False)\n", 278 | "train time: 0.011s\n", 279 | "test time: 0.000s\n", 280 | "accuracy: 0.910\n", 281 | "classification report:\n", 282 | " precision recall f1-score support\n", 283 | "\n", 284 | " male 0.86 0.93 0.89 40\n", 285 | " female 0.95 0.90 0.92 60\n", 286 | "\n", 287 | "avg / total 0.91 0.91 0.91 100\n", 288 | "\n", 289 | "========================================================================================================================\n", 290 | "kNN\n", 291 | "________________________________________________________________________________________________________________________\n", 292 | "Training: \n", 293 | "KNeighborsClassifier(algorithm='auto', leaf_size=30, metric='minkowski',\n", 294 | " metric_params=None, n_neighbors=100, p=2, weights='uniform')\n", 295 | "train time: 0.001s\n", 296 | "test time: 0.027s\n", 297 | "accuracy: 0.550\n", 298 | "classification report:\n", 299 | " precision recall f1-score support\n", 300 | "\n", 301 | " male 0.47 0.95 0.63 40\n", 302 | " female 0.89 0.28 0.43 60\n", 303 | "\n", 304 | "avg / total 0.72 0.55 0.51 100\n", 305 | "\n", 306 | "========================================================================================================================\n", 307 | "Random forest\n", 308 | "________________________________________________________________________________________________________________________\n", 309 | "Training: \n", 310 | "RandomForestClassifier(bootstrap=True, class_weight=None, criterion='gini',\n", 311 | " max_depth=None, max_features='auto', max_leaf_nodes=None,\n", 312 | " min_samples_leaf=1, min_samples_split=2,\n", 313 | " min_weight_fraction_leaf=0.0, n_estimators=100, n_jobs=1,\n", 314 | " oob_score=False, random_state=None, verbose=0,\n", 315 | " warm_start=False)\n", 316 | "train time: 0.385s" 317 | ] 318 | }, 319 | { 320 | "output_type": "stream", 321 | "stream": "stdout", 322 | "text": [ 323 | "\n", 324 | "test time: 0.016s\n", 325 | "accuracy: 0.850\n", 326 | "classification report:\n", 327 | " precision recall f1-score support\n", 328 | "\n", 329 | " male 0.76 0.93 0.83 40\n", 330 | " female 0.94 0.80 0.86 60\n", 331 | "\n", 332 | "avg / total 0.87 0.85 0.85 100\n", 333 | "\n", 334 | "========================================================================================================================\n", 335 | "SGD\n", 336 | "________________________________________________________________________________________________________________________\n", 337 | "Training: \n", 338 | "SGDClassifier(alpha=0.0001, average=False, class_weight=None, epsilon=0.1,\n", 339 | " eta0=0.0, fit_intercept=True, l1_ratio=0.15,\n", 340 | " learning_rate='optimal', loss='hinge', n_iter=50, n_jobs=1,\n", 341 | " penalty='l2', power_t=0.5, random_state=None, shuffle=True,\n", 342 | " verbose=0, warm_start=False)\n", 343 | "train time: 0.013s\n", 344 | "test time: 0.000s\n", 345 | "accuracy: 0.880\n", 346 | "classification report:\n", 347 | " precision recall f1-score support\n", 348 | "\n", 349 | " male 0.89 0.80 0.84 40\n", 350 | " female 0.88 0.93 0.90 60\n", 351 | "\n", 352 | "avg / total 0.88 0.88 0.88 100\n", 353 | "\n" 354 | ] 355 | }, 356 | { 357 | "metadata": {}, 358 | "output_type": "display_data", 359 | "png": "iVBORw0KGgoAAAANSUhEUgAAAfwAAAEuCAYAAABrpKA3AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XmYFdWd//H3pxtka1pWMbKjjKhBxYXooAGXGHFL5BeN\nRlGcaIyJS8YYjYJCojGjicuYGI0OiFFDjMaMBuMWHSJRUdBWcEGUCIq4gQtLEKH5/v64p/HSdtO3\n297r83qeem7dqlOnTp27fKtOnapSRGBmZmatW1FTF8DMzMwangO+mZlZBjjgm5mZZYADvpmZWQY4\n4JuZmWWAA76ZmVkGOOCbWZOR1EvSo5JWSPpFU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b+T9\n99/n1FNP5YgjjuCTTz6pdT2bVeaAb2bNxqRJk+jQoQPt2rUDckfmnTp1om3btkycOJHnnnuOlStX\nbkyf35Tetm1bLrroIoqLixk9ejQlJSW8/PLLtUpbXl7OXXfdxU9+8hPat2/PDjvswIknnlhtk32h\nTfnnnnsuJSUl7LjjjgwdOpTRo0czYMAASktLGT16NGVlZQDccMMNnHrqqey5555I4oQTTqBdu3bM\nmjWr8Eo0q4YDvpk1G3379t04vmHDBn784x+z3XbbseWWWzJw4EAAli1bVuWy3bt336TjXMeOHVm1\nalWt0r733nusX79+k3L06dPnc20TQK9evTaOd+jQYZP37du3Z/Xq1QAsXryYK664gq5du24clixZ\nwltvvfW5y2DmgG9mja66JvL86bfddhv33HMPDz/8MB999BGvvfYasOlRdW06pBaStmfPnrRp04Y3\n3nhj47T88brkWZty9evXj/Hjx/PBBx9sHFatWsU3v/nNz70eMwd8M2t0vXr1YuHChZtNs2rVKtq1\na0e3bt1YvXo1F1xwwSbzI6LgJvVC0xYXFzNmzBgmTZrEmjVrmD9/Prfccku1gb1nz54UFRXVuC1V\nlaeqsp1yyilcf/31PPXUU0QEq1ev5t577622pcKsNlrOdS9m9vlNauoC5Jx//vmcccYZnHvuuVx4\n4YWMGTPmM0H1hBNO4IEHHqB37950796dn/70p/z2t7/dOL9yR7zNHW3XJu2vf/1rxo0bx9Zbb82Q\nIUM49thjmTNnTpVpO3bsyPjx4xkxYgTr16/nvvvuK2hdledXvN9999258cYbOf3003nllVfo0KED\n++67LyNHjqy2vGaF8o13WjlJUas/+Um+prg18E1Z6s95553Hu+++y0033dTURdmEP+PsquuNd9yk\nb2aW5+WXX2bu3LlEBE899RRTpkzhyCOPbOpimX1ubtI3M8uzcuVKjj32WJYuXUqvXr0455xzOOKI\nI5q6WGafmwO+mVmePfbYg1deeaWpi2FW79ykb2ZmlgHutNfKSar1B+zvRMvnDl2tnz/j7PLT8qxa\n/lMwMzM36ZuZmWWAA76ZmVkGOOCbWeZ07tyZRYsWNXUxzBqVA75ZRlTcwrUhh0INGDCARx555HNv\n09SpU9l33303m2bUqFFMnjx5k2krV65kwIABn3v9Zi2JO+1lQH080ctai4bswFm7J9c1VmfS1vz9\nb83b1pgy07G54klNHlrnAER4yNyQ+2lvCmjg1X52nVU5/vjjo6ioKDp06BAlJSXxi1/8IiIinnji\nidh7772jS5cuscsuu8SMGTM2LnPTTTfFoEGDonPnzjFw4MC47bbb4qWXXop27dpFcXFxlJSURNeu\nXT+zrgsuuCCKi4ujffv2UVJSEmeccUZEREiKhQsXRkTEiSeeGKeddlqMHj06SkpKYp999om33nor\nzjzzzOjSpUsMGTIkysrKNub55ptvxpgxY6Jnz54xcODAuOaaawra7vrm33bD/Vaau1RmajvUegEP\nLWvwn0I2h+Yc8CMiBgwYEA8//PDG90uWLInu3bvHfffdFxERDz30UHTv3j2WLVsWq1atitLS0liw\nYEFERLz99tvxwgsvRETE1KlTY5999tnsukaNGhWTJ0/eZFrlgN+jR4945pln4uOPP479998/+vfv\nH7fcckts2LAhJkyYEPvtt19ERJSXl8duu+0WF198caxbty7++c9/xqBBg+KBBx4oeNvri3/bDfdb\nae7qGvB9Dt/Mmtytt97KIYccwsEHHwzAgQceyB577MG9996LJIqKipg3bx5r1qyhV69e7LjjjgDk\n/vtqtrl0khgzZgzDhg2jXbt2HHnkkXTq1Injjz8eSRx99NGUlZUBMHv2bJYtW8aECRNo06YNAwcO\n5OSTT+YPf/jD56wBs4bngG9mTW7x4sXccccddO3adePw2GOP8fbbb9OxY0duv/12rr/+erbZZhsO\nO+wwXn755VrlX9O57q222mrjePv27Td536FDB1atWrWxnEuXLt2knD//+c959913a1Ues6bgTntm\n1ugqB+B+/foxduxYbrjhhirTH3TQQRx00EGsXbuW8ePHc8opp/Doo48W1GmtPju29e3bl4EDB7Jg\nwYJ6y9OssdR4hC9pvKTnJT0nqUzScEnFki6VtCBNK5N0Qd4y5Wna85KelXS28n51KY9HJc2X9Iyk\nGyV1kDRO0q/qa+Mk3SupNI2fKel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cfh5RT0By4E2TV32JqirfcndvXZeNfNr/b/uI/yWbzjwakQs\nioh15C5j/FqlNEeQuwshEfEk0EVSr8YtZrNQY11FxBMR8VF6+yTQp5HL2FwU8r2C3CW0dwLvNWbh\nmplC6upbwJ8iYglA5C5RzqJC6uotPr33SimwPCLWN2IZm4WImAl8sJkktf5fd8Bv+XoDb+S9X5Km\n1ZQmi4GskLrK923grw1aouarxrqS1Jvcn/V1aVJWewAX8r0aDHST9H+S5kga22ila14KqasbgZ0k\nLQWeA85qpLK1NLX+X29Ol+VZ3RT6J1v58rws/jkXvM2S9gP+AxjRcMVp1gqpq6uBH0dEKHfP7axe\nAlpIXbUFdiP3jJGOwBOSZkWlW5RnQCF1dQHwbESMSndRfUjSLhGxsoHL1hLV6n/dAb/lexPom/e+\nL7k9vc2l6ZOmZU0hdUXqqHcjcHBEbK5JrTUrpK52B/6Qnq/RAxgtaV1E3NM4RWw2CqmrN4BlEbEG\nWCPpUWAXIGsBv5C6+nfgZwARsTDdlG17YE6jlLDlqPX/upv0W745wGBJAyRtQe45BJX/cO8h92RC\nJO1F7jHE7zRuMZuFGutKUj9yT1k8Pj59CmMW1VhXETEoIgZGxEBy5/FPy2Cwh8J+g3cD+0gqTo8T\n/xLwYiOXszkopK7mAwcCpHPS2wP/bNRStgy1/l/3EX4LFxHrJZ1O7qFGxcDkiHhJ0qlp/m8j4q+S\nDpH0KrknDZ7UhEVuMoXUFXAR0BW4Lh25rouI4U1V5qZSYF0ZBf8G50u6H5gLbABujIjMBfwCv1eX\nAjel56oUAedGBm+5LmkaMBLoIekNYCK5U0N1/l/3nfbMzMwywE36ZmZmGeCAb2ZmlgEO+GZmZhng\ngG9mZpYBDvhmZmYZ4IBvZmaWAQ74ZmZmGeCAb2ZmlgH/HxtedjNPIkYHAAAAAElFTkSuQmCC\n", 360 | "text": [ 361 | "" 362 | ] 363 | } 364 | ], 365 | "prompt_number": 197 366 | } 367 | ], 368 | "metadata": {} 369 | } 370 | ] 371 | } --------------------------------------------------------------------------------