This is Bostock's interactive Reingold-Tilford Tree with data representing the rules of a simple sklearn decision tree. Click on nodes to expand or collapse.
For more, see the complete write-up.
| from sklearn.metrics import roc_curve, auc | |
| # Compute ROC curve and ROC area for each class | |
| fpr = dict() | |
| tpr = dict() | |
| roc_auc = dict() | |
| for i in range(n_classes): | |
| fpr[i], tpr[i], _ = roc_curve(y[:, i], preds[:, i]) | |
| roc_auc[i] = auc(fpr[i], tpr[i]) | |
| # Compute micro-average ROC curve and ROC area |
| import os | |
| from IPython.core.display import Javascript | |
| from IPython.display import display | |
| import datetime | |
| display(Javascript('Jupyter.notebook.kernel.execute(\ | |
| "this_notebook = " + "\'"\ | |
| +Jupyter.notebook.notebook_name+"\'");')) |
| select B.*, A.* | |
| from B | |
| left outer join A ON | |
| (A.[id1] = B.[id1] or (coalesce(A.[id1],B.[id1]) is null)) | |
| # matching functions from https://alexwlchan.net/2017/07/listing-s3-keys/ | |
| # https://alexwlchan.net/2018/01/listing-s3-keys-redux/ | |
| import boto3 | |
| import datetime | |
| import os | |
| def get_matching_s3_objects(bucket, prefix='', suffix=''): |
| # Run this from the bash command prompt. Make sure that jq is installed https://github.com/stedolan/jq/wiki/Installation | |
| # json_temp.json has the file in the form [{...}, {...}, {...}] and coverts to {...}\n{...}\n | |
| jq -c '.[]' json_temp.json > json_temp.jsonl | |
| # From within python can do this: | |
| pip install jsonlines | |
| import json | |
| import jsonlines |
| # From https://stackoverflow.com/questions/14495176/compress-file-on-s3 | |
| aws s3 sync s3://your-pics . | |
| for i in `find | grep -E "\.jpg$|\.jpg$"`; do gzip "$i" ; echo $i; done | |
| aws s3 sync . s3://your-pics --content-encoding gzip --dryrun |
This is Bostock's interactive Reingold-Tilford Tree with data representing the rules of a simple sklearn decision tree. Click on nodes to expand or collapse.
For more, see the complete write-up.