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)
# 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 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 |
import time | |
import pygame | |
import gym | |
frame_time = 1.0 / 15 # seconds | |
pygame.init() |
import tensorflow as tf | |
w = tf.Variable([2.0]) | |
b = tf.Variable([2.0]) | |
x = tf.constant([1.0]) | |
y = tf.sigmoid(w*x + b) | |
y_ = tf.constant([0.0]) | |
cross_entropy = -1*(y_*tf.log(y) + (1-y_)*(tf.log(1-y))) | |
s = tf.Session() | |
s.run(tf.initialize_all_variables()) |
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.
def _find_getch(): | |
# courtesy of Louis | |
# http://stackoverflow.com/questions/510357/ | |
try: | |
import termios | |
except ImportError: | |
# Non-POSIX. Return msvcrt's (Windows') getch. | |
import msvcrt | |
return msvcrt.getch |
Here is text with an email link.
Here is an email in text ([email protected]).
What about second-line email links?