social()
import scipy.stats as stats
import numpy as np
%matplotlib inline
from matplotlib import pyplot as plt
import seaborn as sns
# Some initial styling
rc={'axes.labelsize': 16.0, 'font.size': 16,
'legend.fontsize': 16.0, 'axes.titlesize': 18,
'xtick.labelsize': 15.0, 'ytick.labelsize': 15.0}
sns.set(context = 'poster', style = 'whitegrid', rc=rc)
a = np.arange(16)
poi = stats.poisson
lambda_ = [1.5, 4.25]
colors = ["#9b59b6", "#3498db"]
plt.bar(a, poi.pmf(a, lambda_[0]), color=colors[0],
label='$\lambda = %.1f$' % lambda_[0], alpha=0.6)
plt.bar(a, poi.pmf(a, lambda_[1]), color=colors[1],
label='$\lambda = %.1f$' % lambda_[1], alpha=0.6)
plt.legend()
plt.xlabel('$k$')
plt.title('Probability mass funtion of a Poisson random variable;\n \
differing $\lambda$ values')
a = np.linspace(0, 4, 100)
expo = stats.expon
lambda_ = [1, 0.5]
for l, c in zip(lambda_, colors):
plt.plot(a, expo.pdf(a, scale=1. /l), color=c,
label='$\lambda = %.1f$' % l,
lw=3)
plt.fill_between(a, expo.pdf(a, scale=1./l), color=c,
alpha=0.33)
plt.legend()
plt.ylabel('PDF at $z$')
plt.xlabel('$z$')
plt.ylim(0, 1.2)
plt.title('Probability density function of an Expoential random variable: \n \
differing $\lambda$')
import pandas as pd
count_data = pd.read_csv('https://raw.githubusercontent.com/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/master/Chapter1_Introduction/data/txtdata.csv',
header=None, names=['msgs'])
N = len(count_data)
plt.bar(np.arange(N), count_data['msgs'], color="#9b59b6", alpha=0.8)
plt.xlabel('Time (days)')
plt.ylabel('count of msgs received')
plt.title('Did the texting habits change over time?')
plt.xlim(0, n)
from IPython.core.display import HTML
def css_styling():
styles = open("/users/ryankelly/desktop/custom_notebook2.css", "r").read()
return HTML(styles)
css_styling()
def social():
code = """
"""
return HTML(code)