Permalink
Browse files

Not adding or removing semicolons

  • Loading branch information...
1 parent df70347 commit 722b169ee32f2674eef9066ca63442f962ca3436 @eli-b eli-b committed Mar 8, 2014
@@ -192,7 +192,7 @@
"def css_styling():\n",
" styles = open(\"../styles/custom.css\", \"r\").read()\n",
" return HTML(styles)\n",
- "css_styling();"
+ "css_styling()"
],
"language": "python",
"metadata": {},
@@ -18,7 +18,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "import pymc as pm;"
+ "import pymc as pm"
],
"language": "python",
"metadata": {},
@@ -40,7 +40,7 @@
" if np.array_equal(fake_obs, obs):\n",
" return uni\n",
" else:\n",
- " return None;"
+ " return None"
],
"language": "python",
"metadata": {},
@@ -51,7 +51,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "mcmc = pm.MCMC([uni, fake_obs, accept]);"
+ "mcmc = pm.MCMC([uni, fake_obs, accept])"
],
"language": "python",
"metadata": {},
@@ -62,7 +62,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "mcmc.sample(10000);"
+ "mcmc.sample(10000)"
],
"language": "python",
"metadata": {},
@@ -89,7 +89,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "samples = mcmc.trace('accept')[:];"
+ "samples = mcmc.trace('accept')[:]"
],
"language": "python",
"metadata": {},
@@ -100,7 +100,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "hist(samples[samples > 0]);"
+ "hist(samples[samples > 0])"
],
"language": "python",
"metadata": {},
@@ -127,7 +127,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "samples[:1000];"
+ "samples[:1000]"
],
"language": "python",
"metadata": {},
@@ -21,7 +21,7 @@
"from requests import get\n",
"response = get('https://api.github.com/repos/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/stats/commit_activity').json()\n",
"weekly_totals = np.array(map(lambda x: x['total'], response))\n",
- "weekly_totals = weekly_totals[np.where(weekly_totals)[0]] # gives me 52 weeks, but project started < 1 year ago so it backwards fills with 0s;"
+ "weekly_totals = weekly_totals[np.where(weekly_totals)[0]] # gives me 52 weeks, but project started < 1 year ago so it backwards fills with 0s"
],
"language": "python",
"metadata": {},
@@ -35,9 +35,9 @@
"count_data = weekly_totals\n",
"n_count_data = len(weekly_totals)\n",
"\n",
- "plt.bar(range(n_count_data), weekly_totals)\n",
+ "plt.bar(range(n_count_data), weekly_totals);\n",
"print weekly_totals\n",
- "print n_count_data;"
+ "print n_count_data"
],
"language": "python",
"metadata": {},
@@ -71,7 +71,7 @@
"lambda_1 = pm.Exponential(\"lambda_1\", alpha)\n",
"lambda_2 = pm.Exponential(\"lambda_2\", alpha)\n",
"\n",
- "tau = pm.DiscreteUniform(\"tau\", lower=0, upper=n_count_data);"
+ "tau = pm.DiscreteUniform(\"tau\", lower=0, upper=n_count_data)"
],
"language": "python",
"metadata": {},
@@ -87,7 +87,7 @@
" out = np.zeros(n_count_data)\n",
" out[:tau] = lambda_1 # lambda before tau is lambda1\n",
" out[tau:] = lambda_2 # lambda after tau is lambda2\n",
- " return out;"
+ " return out"
],
"language": "python",
"metadata": {},
@@ -100,7 +100,7 @@
"input": [
"observation = pm.Poisson(\"obs\", lambda_, value=count_data, observed=True)\n",
"\n",
- "model = pm.Model([observation, lambda_1, lambda_2, tau]);"
+ "model = pm.Model([observation, lambda_1, lambda_2, tau])"
],
"language": "python",
"metadata": {},
@@ -113,7 +113,7 @@
"input": [
"# Mysterious code to be explained in Chapter 3.\n",
"mcmc = pm.MCMC(model)\n",
- "mcmc.sample(40000, 10000, 1);"
+ "mcmc.sample(40000, 10000, 1)"
],
"language": "python",
"metadata": {},
@@ -142,7 +142,7 @@
"input": [
"lambda_1_samples = mcmc.trace('lambda_1')[:]\n",
"lambda_2_samples = mcmc.trace('lambda_2')[:]\n",
- "tau_samples = mcmc.trace('tau')[:];"
+ "tau_samples = mcmc.trace('tau')[:]"
],
"language": "python",
"metadata": {},
@@ -188,7 +188,7 @@
"plt.legend(loc=\"upper left\")\n",
"plt.ylim([0, .75])\n",
"plt.xlabel(\"$\\tau$ (in days)\")\n",
- "plt.ylabel(\"probability\");"
+ "plt.ylabel(\"probability\")"
],
"language": "python",
"metadata": {},
@@ -211,7 +211,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "n_count_data;"
+ "n_count_data"
],
"language": "python",
"metadata": {},
@@ -230,7 +230,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "lambda_2_samples;"
+ "lambda_2_samples"
],
"language": "python",
"metadata": {},
@@ -30,7 +30,7 @@
"print ids[:10]\n",
"print\n",
"print \"Number of unique ids found: \", ids.shape[0]\n",
- "print \"Largest user id: \", ids.max();"
+ "print \"Largest user id: \", ids.max()"
],
"language": "python",
"metadata": {},
@@ -87,7 +87,7 @@
"input": [
"figsize(12.5, 3)\n",
"plt.hist(ids, bins=45, alpha=0.9)\n",
- "plt.title(\"Histogram of %d Github User ids\" % ids.shape[0])\n",
+ "plt.title(\"Histogram of %d Github User ids\" % ids.shape[0]);\n",
"plt.xlabel(\"User id\")\n",
"plt.ylabel(\"Frequency\");"
],
@@ -144,7 +144,7 @@
"\n",
"# code to be examplained in Chp. 3.\n",
"mcmc = pm.MCMC([upper_bound, obs])\n",
- "mcmc.sample(100000, 45000);"
+ "mcmc.sample(100000, 45000)"
],
"language": "python",
"metadata": {},
@@ -176,7 +176,7 @@
"hist(samples, bins=100,\n",
" label=\"Uniform prior\",\n",
" normed=True, alpha=0.8,\n",
- " histtype=\"stepfilled\", color=\"#7A68A6\")\n",
+ " histtype=\"stepfilled\", color=\"#7A68A6\");\n",
"\n",
"quantiles_mean = np.append(mquantiles(samples, [0.05, 0.5, 0.95]), samples.mean())\n",
"print \"Quantiles: \", quantiles_mean[:3]\n",
@@ -45,7 +45,7 @@
"plt.ylabel(\"Damage Incident?\")\n",
"plt.xlabel(\"Outside temperature (Farhenhit)\")\n",
"plt.title(\"(Artificial) Defects of the Space Shuttle O-Rings vs \\\n",
- "temperature\");"
+ "temperature\")"
],
"language": "python",
"metadata": {},
@@ -87,7 +87,7 @@
"p_hat = logistic(temperature, beta_hat, alpha_hat)\n",
"print \"estimates of probability at observed temperature, defects: \"\n",
"print np.array(zip(p_hat, temperature, D))[:3, :]\n",
- "print \"...\";"
+ "print \"...\""
],
"language": "python",
"metadata": {},
@@ -140,7 +140,7 @@
"print p_hat\n",
"_product = p_hat ** (D) * (1 - p_hat) ** (1 - D)\n",
"prob_given_model_1 = _product.prod()\n",
- "print \"probability of observations, model 1: %.10f\" % prob_given_model_1;"
+ "print \"probability of observations, model 1: %.10f\" % prob_given_model_1"
],
"language": "python",
"metadata": {},
@@ -198,7 +198,7 @@
"print \"estimates of probability at observed temperature, defects: \"\n",
"print np.array(zip(p_hat, temperature, D))[:3, :]\n",
"print\n",
- "print \"Notice the probability is constant for all temperatures?\";"
+ "print \"Notice the probability is constant for all temperatures?\""
],
"language": "python",
"metadata": {},
@@ -224,7 +224,7 @@
"\n",
"_product = p_hat ** (D) * (1 - p_hat) ** (1 - D)\n",
"prob_given_model_2 = _product.prod()\n",
- "print \"probability of observations, model 2: %.10f\" % prob_given_model_2;"
+ "print \"probability of observations, model 2: %.10f\" % prob_given_model_2"
],
"language": "python",
"metadata": {},
@@ -246,7 +246,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "print \"Bayes factor = %.3f\" % (prob_given_model_1 / prob_given_model_2);"
+ "print \"Bayes factor = %.3f\" % (prob_given_model_1 / prob_given_model_2)"
],
"language": "python",
"metadata": {},
@@ -292,7 +292,7 @@
"prob_given_model_2 = _product.prod(axis=1).mean()\n",
"print \"expected prob. of obs., given model 2: %.10f\" % prob_given_model_2\n",
"print\n",
- "print \"Bayes factor: %.3f\" % (prob_given_model_1 / prob_given_model_2);"
+ "print \"Bayes factor: %.3f\" % (prob_given_model_1 / prob_given_model_2)"
],
"language": "python",
"metadata": {},
@@ -42,7 +42,7 @@
"pl.plot(wavelength, profile1, color='red', linestyle='dashed', label=\"1\")\n",
"pl.plot(wavelength, profile2, color='green', linestyle='dashed', label=\"2\")\n",
"pl.title(\"Feature One and Two\")\n",
- "pl.legend();"
+ "pl.legend()"
],
"language": "python",
"metadata": {},
@@ -96,7 +96,7 @@
" return profile_1 + profile_2\n",
"\n",
"\n",
- "observations = pm.Normal(\"obs\", mean, std_deviation, value=combined, observed=True);"
+ "observations = pm.Normal(\"obs\", mean, std_deviation, value=combined, observed=True)"
],
"language": "python",
"metadata": {},
@@ -116,7 +116,7 @@
" std_deviation])\n",
"\n",
"map_ = pm.MAP(model)\n",
- "map_.fit();"
+ "map_.fit()"
],
"language": "python",
"metadata": {},
@@ -128,7 +128,7 @@
"collapsed": false,
"input": [
"mcmc = pm.MCMC(model)\n",
- "mcmc.sample(70000, 60000);"
+ "mcmc.sample(70000, 60000)"
],
"language": "python",
"metadata": {},
@@ -155,7 +155,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "mcplot(mcmc);"
+ "mcplot(mcmc)"
],
"language": "python",
"metadata": {},

0 comments on commit 722b169

Please sign in to comment.