generated from alshedivat/al-folio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d38b1c9
commit 3a67c22
Showing
2 changed files
with
960 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
layout: post | ||
title: P-value vs Bayes' Factor - frequentist and Bayesian hypothesis testing | ||
date: 2024-01-11 08:57:00-0400 | ||
description: | ||
tags: statistics Bayesian frequentist hypothesis testing | ||
categories: statistics | ||
giscus_comments: true | ||
related_posts: false | ||
--- | ||
|
||
To include a jupyter notebook in a post, you can use the following code: | ||
|
||
{% raw %} | ||
|
||
```html | ||
{::nomarkdown} {% assign jupyter_path = "assets/jupyter/hypothesis_testing.ipynb" | relative_url %} {% capture notebook_exists %}{% file_exists | ||
assets/jupyter/blog.ipynb %}{% endcapture %} {% if notebook_exists == "true" %} {% jupyter_notebook jupyter_path %} {% else %} | ||
<p>Sorry, the notebook you are looking for does not exist.</p> | ||
{% endif %} {:/nomarkdown} | ||
``` | ||
|
||
{% endraw %} | ||
|
||
Let's break it down: this is possible thanks to [Jekyll Jupyter Notebook plugin](https://github.com/red-data-tools/jekyll-jupyter-notebook) that allows you to embed jupyter notebooks in your posts. It basically calls [`jupyter nbconvert --to html`](https://nbconvert.readthedocs.io/en/latest/usage.html#convert-html) to convert the notebook to an html page and then includes it in the post. Since [Kramdown](https://jekyllrb.com/docs/configuration/markdown/) is the default Markdown renderer for Jekyll, we need to surround the call to the plugin with the [::nomarkdown](https://kramdown.gettalong.org/syntax.html#extensions) tag so that it stops processing this part with Kramdown and outputs the content as-is. | ||
|
||
The plugin takes as input the path to the notebook, but it assumes the file exists. If you want to check if the file exists before calling the plugin, you can use the `file_exists` filter. This avoids getting a 404 error from the plugin and ending up displaying the main page inside of it instead. If the file does not exist, you can output a message to the user. The code displayed above outputs the following: | ||
|
||
{::nomarkdown} | ||
{% assign jupyter_path = "assets/jupyter/blog.ipynb" | relative_url %} | ||
{% capture notebook_exists %}{% file_exists assets/jupyter/blog.ipynb %}{% endcapture %} | ||
{% if notebook_exists == "true" %} | ||
{% jupyter_notebook jupyter_path %} | ||
{% else %} | ||
|
||
<p>Sorry, the notebook you are looking for does not exist.</p> | ||
{% endif %} | ||
{:/nomarkdown} | ||
|
||
Note that the jupyter notebook supports both light and dark themes. |
Oops, something went wrong.