Skip to content

Instantly share code, notes, and snippets.

View wadeschulz's full-sized avatar

Wade Schulz, MD, PhD wadeschulz

View GitHub Profile

Keybase proof

I hereby claim:

  • I am wadeschulz on github.
  • I am wschulz (https://keybase.io/wschulz) on keybase.
  • I have a public key ASDc9xcqo_rSH7YC7NaURXUOC0JTO5rPMzFxMeiUxWlU2wo

To claim this, I am signing this object:

@wadeschulz
wadeschulz / mimic-deid-preprocessing.py
Last active December 18, 2018 13:35
Python Regex to Preprocess Deidentified Sections of MIMIC-III Notes
regex1 = re.compile("\[\*\*(\d*\-\d*\-\d*)\*\*\]") # regex to remove special characters from shifted yyyy-MM-dd format
regex2 = re.compile("\[\*\*(\d*\-\d*)\*\*\]") # regex to remove special characters from shifted MM-dd format
regex3 = re.compile("\[\*\*(\d*)\*\*\]") # regex to remove special characters from shifted MM or dd format
regex4 = re.compile("\[\*\*[^\*]+\*\*\]") # regex to remove remaining de'id fields
@wadeschulz
wadeschulz / scores-to-roc.py
Created December 10, 2017 23:04
Create ROC curve from ML scores in numpy array
from sklearn import metrics
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
def create_roc_curve(labels, scores, positive_label)
fpr, tpr, thresholds = metrics.roc_curve(labels, scores, pos_label=positive_label)
roc_auc = auc(fpr, tpr)
plt.title('Receiver Operating Characteristic')
@wadeschulz
wadeschulz / hash_generator.py
Created January 6, 2016 13:08
Python script to generate md5 and sha1 hashes for files of given extension in a directory
import hashlib, os
def hashfile(afile, hasher, blocksize=65536):
buf = afile.read(blocksize)
while len(buf) > 0:
hasher.update(buf)
buf = afile.read(blocksize)
return hasher.hexdigest()
path = raw_input("Enter directory to scan: ")