Skip to content

Instantly share code, notes, and snippets.

View saulshanabrook's full-sized avatar
🏊

Saul Shanabrook saulshanabrook

🏊
View GitHub Profile
#!/bin/bash
git clone https://github.com/DamnWidget/anaconda /anaconda
cd /anaconda
git checkout vagrant_server
cat >config.py <<EOF
python_interpreter = "python" # the interpreter to use
project = "anaconda" # the name of the project
extra_paths = None # a list of extra paths
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{
"metadata": {
"name": "",
"signature": "sha256:dac4c1e908e671b2f9222884d3ed013270055d3ad43e784cf7526efb5a2fd0a4"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@saulshanabrook
saulshanabrook / find_fk_doesnt_exist.py
Created April 3, 2015 12:49
Find FK doesnt exist
def find_fk_doesnt_exist(model, field_name):
field = getattr(model, field_name)
related_model = field.field.related.parent_model
available_fk_pks = related_model.objects.values_list('pk', flat=True)
for instance in model.objects.all().exclude(**{field_name + '__isnull': True}):
if getattr(instance, field_name + '_id') not in available_fk_pks:
yield instance
@saulshanabrook
saulshanabrook / script.py
Created April 18, 2015 04:19
Isolate dumpdata failure Django
import sys
import os
from django.apps import apps
from django.core.management import call_command
from django.core.management.base import CommandError
for app in set([path.__module__.split('.')[-2] for path in apps.get_models()]):
try:
print "Trying {}".format(app)
<html><head><title>Lighting Design Doc</title><meta content="text/html; charset=UTF-8" http-equiv="content-type"><style type="text/css">@import url('https://themes.googleusercontent.com/fonts/css?kit=Zhfjj_gat3waL4JSju74E5KZlXp2NjsiipqDtBkg26Ji-i3ynI8NvFXysMjBstzg');.lst-kix_y291l4i7csd8-0>li{counter-increment:lst-ctn-kix_y291l4i7csd8-0}.lst-kix_m61bwifzx2vm-4>li{counter-increment:lst-ctn-kix_m61bwifzx2vm-4}.lst-kix_y291l4i7csd8-6>li:before{content:"" counter(lst-ctn-kix_y291l4i7csd8-6,decimal) ". "}.lst-kix_mrkaejkow017-7>li:before{content:"" counter(lst-ctn-kix_mrkaejkow017-7,lower-latin) ". "}.lst-kix_z1o4bed65pky-4>li{counter-increment:lst-ctn-kix_z1o4bed65pky-4}.lst-kix_mrkaejkow017-8>li:before{content:"" counter(lst-ctn-kix_mrkaejkow017-8,lower-roman) ". "}.lst-kix_m61bwifzx2vm-2>li{counter-increment:lst-ctn-kix_m61bwifzx2vm-2}ol.lst-kix_mrkaejkow017-0.start{counter-reset:lst-ctn-kix_mrkaejkow017-0 0}.lst-kix_m61bwifzx2vm-4>li:before{content:"" counter(lst-ctn-kix_m61bwifzx2vm-4,lower-latin) ". "}.lst-k
{
local: {
cues: {
new: newCue(),
$newValid: [
['local', 'cues', 'new'],
['local', 'cues', '$allNames'],
(cue, allCueNames) => cue && (cue.name || '').length > 0 && !_.includes(allCueNames, cue.name)
],
$count: [

Keybase proof

I hereby claim:

  • I am saulshanabrook on github.
  • I am saulshanabrook (https://keybase.io/saulshanabrook) on keybase.
  • I have a public key whose fingerprint is 7510 BE75 3DA9 A174 A2B7 D32F E7D1 D170 8E0E E782

To claim this, I am signing this object:

Question

Consider a simple model for whether a person has the flu or not. Let F=1 indicate that a person has the flu and F=0 indicate that they don't have the flu. Let C=1 indicate that the person has a cough and C=0 indicate that they don't have a cough. Let M=1 indicate that the person has muscle pain and M=0 indicate that they don't have muscle pain. Assume that C and M are conditionally independent given F so that the probability model is P(C=c,M=m,F=f)=P(C=c|F=f)P(M=m|F=f)P(F=f).

Suppose that we ask two different doctors to supply probabilities for this model and we obtain the following results: Doctor 1: P(F=1)=0.4 P(C=1|F=0)=0.2, P(C=1|F=1)=0.8 P(M=1|F=0)=0.3, P(M=1|F=1)=0.9

Consider a simple model for whether a person has the flu or not. Let F=1 indicate that a person has the flu and F=0 indicate that they don't have the flu. Let C=1 indicate that the person has a cough and C=0 indicate that they don't have a cough. Let M=1 indicate that the person has muscle pain and M=0 indicate that they don't have muscle pain. Assume that C and M are conditionally independent given F so that the probability model is P(C=c,M=m,F=f)=P(C=c|F=f)P(M=m|F=f)P(F=f). Suppose that we ask two different doctors to supply probabilities for this model and we obtain the following results: