This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def cdf2pdf( f, u, delta=0.001, kwargs={} ): | |
""" | |
Computes every partial derivative of the CDF to find the underlying PDF. | |
f: a numpy vectorized python/numpy function | |
u: the point to evaluate the CDF at. | |
delta: the precision | |
kwargs: additional keywords args to f | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
{I have|I've} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any interesting article like yours. {It's|It | |
is} pretty worth enough for me. {In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web owners} and bloggers made good content as | |
you did, the {internet|net|web} will be {much more|a lot more} | |
useful than ever before.| | |
I {couldn't|could not} {resist|refrain from} commenting. {Very well|Perfectly|Well|Exceptionally well} written!| | |
{I will|I'll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch} | |
your {rss|rss feed} as I {can not|can't} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink} or {newsletter|e-newsletter} service. Do {you have|you've} any? | |
{Please|Kindly} {allow|permit|let} me {realize|recognize|understand|recognise|know} {so that|in order that} I {may just|may|could} subscribe. | |
Thanks.| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import random | |
CURLY_RE = re.compile( "\{(.*?)\}" ) | |
def spam( filename ): | |
file = open(filename, "r") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from sklearn.linear_model import LinearRegression | |
#create some random data. | |
x1 = np.random.randn(250,1) | |
x2 = 0.001*np.random.randn(250,1) - x1 | |
x3 = np.random.randn(250,1) | |
# Y is a linear combination of the created data, with | |
# weights (10,10,0.01) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android | |
from time import sleep | |
from requests import post | |
droid = android.Android() | |
SERVER = "http://artech.herokuapp.com" | |
ID = 0 | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%pylab | |
import scipy.stats as stats | |
print "Best to use custom matplotlibrc located in /styles directory of BMH project." | |
figure( figsize= ( 8, 11 ) ) | |
#means = np.random.uniform( -4, 4, size = 5 ) | |
means = np.array([ 3.90933614, -1.15148996, 1.70045292, -3.27613385, -0.71058847]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
p1 = 0.9 | |
p2 = 0.1 | |
N = 10000 | |
s = 0.0 | |
i = 0 | |
while i < N: |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# using %matploblib <backend> also imports the following helpers | |
from matplotlib import pylplot as plt | |
from IPython.core.pylabtools import figsize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def exponential_survival_data(n, cr=0.05, scale=1.): | |
t = stats.expon.rvs(scale=scale, size=n) | |
if cr == 0.0: | |
return t, np.ones(n, dtype=bool) | |
def pF(h): | |
v = 1.0*h/scale | |
return v / (np.exp(v)-1) - cr |
OlderNewer