chi-squared test
import scipy.stats
obs = np.array([[a, b],
[c, d]])
_, p, _, _ = scipy.stats.chi2_contingency(obs)
chi-squared test
import scipy.stats
obs = np.array([[a, b],
[c, d]])
_, p, _, _ = scipy.stats.chi2_contingency(obs)
par(pty='s') | |
par(mfrow=c(1, 2)) | |
ci_lower_bound <- function(pos, n, confidence) { | |
if (n == 0) return(0) | |
z = qnorm(1 - (1 - confidence) / 2) | |
p = pos / n | |
(p + z^2 / (2*n) - z * sqrt((p * (1-p) + z^2 / (4*n)) / n )) / | |
(1 + z^2 / n) |
#!/usr/bin/env python | |
import sys | |
import csv | |
def MeanAveragePrecision(valid_filename, attempt_filename, at=10): | |
at = int(at) | |
valid = dict() | |
for line in csv.DictReader(open(valid_filename,'r')): | |
valid.setdefault(line['source_node'],set()).update(line['destination_nodes'].split(" ")) |
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.
# inspired by and based on: | |
# https://julien.danjou.info/python-exceptions-guide/ | |
# https://github.com/jd/julien.danjou.info/blob/master/bin/generate-python-exceptions-graph.py | |
import builtins | |
edges = set() | |
synonyms = {} | |
for name in dir(builtins): | |
item = getattr(builtins, name) |
import time | |
import pygame | |
import gym | |
frame_time = 1.0 / 15 # seconds | |
pygame.init() |
import random | |
import math | |
def mean(elements): | |
return sum(elements) / len(elements) | |
def euclidean_dist(first, second): | |
assert len(first) == len(second) | |
return sum((f - s)**2 for f, s in zip(first, second))**0.5 |
#!/bin/bash | |
# Start an AWS instance with one of the AMIs provided by: | |
# http://www.louisaslett.com/RStudio_AMI/ | |
# | |
# Get this script and make executable. | |
# wget THE_RAW_URL | |
# chmod +x build_logins.sh | |
# | |
# Then use this script to create many logins on the system. |
Here is text with an email link.
Here is an email in text (someone@somewhere.org).
What about second-line email links?