Skip to content

Commit

Permalink
Fixed the segfault in last failing cell in the MMD notebook
Browse files Browse the repository at this point in the history
- Present state of the notebook at this commit:
  https://gist.github.com/lambday/2fb59fbf828e8ad38bff0f2c095c1edc
  • Loading branch information
lambday committed Nov 17, 2016
1 parent 6b09feb commit e02a0fa
Showing 1 changed file with 5 additions and 8 deletions.
Expand Up @@ -921,16 +921,14 @@
"outputs": [],
"source": [
"# mmd instance using streaming features\n",
"block_size=100\n",
"m=1000\n",
"mmd=sg.LinearTimeMMD(gen_p, gen_q)\n",
"mmd.set_num_samples_p(m)\n",
"mmd.set_num_samples_q(m)\n",
"mmd.set_num_blocks_per_burst(block_size)\n",
"\n",
"sigmas=[2**x for x in linspace(-5, 5, 10)]\n",
"sigmas=[2**x for x in np.linspace(-5, 5, 11)]\n",
"print \"Choosing kernel width from\", [\"{0:.2f}\".format(sigma) for sigma in sigmas]\n",
"combined=sg.CombinedKernel()\n",
"\n",
"for i in range(len(sigmas)):\n",
" mmd.add_kernel(sg.GaussianKernel(10, sigmas[i]))\n",
"\n",
Expand All @@ -940,12 +938,10 @@
"# must be set true for kernel selection\n",
"mmd.set_train_test_mode(True)\n",
"\n",
"# use 50% of the data to perform training (selecting the kernel)\n",
"mmd.set_train_test_ratio(1)\n",
"\n",
"# select best kernel\n",
"best_kernel=mmd.select_kernel()\n",
"mmd.select_kernel()\n",
"\n",
"best_kernel=mmd.get_kernel()\n",
"best_kernel=sg.GaussianKernel.obtain_from_generic(best_kernel)\n",
"print \"Best single kernel has bandwidth %.2f\" % best_kernel.get_width()"
]
Expand Down Expand Up @@ -989,6 +985,7 @@
"m=5000\n",
"mmd.set_num_samples_p(m)\n",
"mmd.set_num_samples_q(m)\n",
"mmd.set_train_test_mode(False)\n",
"num_samples=500\n",
"\n",
"# sample null and alternative distribution, implicitly generate new data for that\n",
Expand Down

0 comments on commit e02a0fa

Please sign in to comment.