Skip to content

Commit 39a837b

Browse files
authored
docs: correct Latex formatting (#348)
1 parent aa53c74 commit 39a837b

File tree

4 files changed

+48
-24
lines changed

4 files changed

+48
-24
lines changed

docs/examples/basic-usage.ipynb

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"Note that the first four element are change point indexes while the last is simply the number of samples.\n",
6969
"(This is a technical convention so that functions in `ruptures` always know the length of the signal at hand.)\n",
7070
"\n",
71-
"It is also possible to plot our $\\mathbb{R}^3$-valued signal along with the true change points with the `rpt.display` function.\n",
71+
"It is also possible to plot our \\(\\mathbb{R}^3\\)-valued signal along with the true change points with the `rpt.display` function.\n",
7272
"In the following image, the color changes whenever the mean of the signal shifts."
7373
]
7474
},
@@ -88,22 +88,24 @@
8888
"## Change point detection\n",
8989
"We can now perform change point detection, meaning that we find the indexes where the signal mean changes.\n",
9090
"To that end, we minimize the sum of squared errors when approximating the signal by a piecewise constant signal.\n",
91-
"Formally, for a signal $y_0,y_1,\\dots,y_{T-1}$ ($T$ samples), we solve the following optimization problem, over all possible change positions $t_1<t_2<\\dots<t_K$ (where the number $K$ of changes is defined by the user):\n",
91+
"Formally, for a signal \\( y_0 , y_1 , \\dots , y_{T-1} \\) (\\( T \\) samples), we solve the following optimization problem, over all possible change positions \\( t_1 < t_2 < \\dots < t_K \\)\n",
92+
"where the number \\( K \\) of changes is defined by the user:\n",
9293
"\n",
93-
"$$\n",
94-
"\\hat{t}_1, \\hat{t}_2,\\dots,\\hat{t}_K = \\arg\\min_{t_1,\\dots,t_K} V(t_1,t_2,\\dots,t_K)\n",
95-
"$$\n",
94+
"\\[\n",
95+
" \\hat{t}_1, \\hat{t}_2,\\dots,\\hat{t}_K = \\arg\\min_{t_1,\\dots,t_K} V(t_1,t_2,\\dots,t_K)\n",
96+
"\\]\n",
9697
"\n",
9798
"with\n",
9899
"\n",
99-
"$$\n",
100-
"V(t_1,t_2,\\dots,t_K) := \\sum_{k=0}^K\\sum_{t=t_k}^{t_{k+1}-1} \\|y_t-\\bar{y}_{t_k..t_{k+1}}\\|^2\n",
101-
"$$\n",
100+
"\\[\n",
101+
" V(t_1,t_2,\\dots,t_K) := \\sum_{k=0}^K\\sum_{t=t_k}^{t_{k+1}-1} \\|y_t-\\bar{y}_{t_k..t_{k+1}}\\|^2\n",
102+
"\\]\n",
102103
"\n",
103-
"where $\\bar{y}_{t_k..t_{k+1}}$ is the empirical mean of the sub-signal $y_{t_k}, y_{t_k+1},\\dots,y_{t_{k+1}-1}$.\n",
104-
"(By convention $t_0=0$ and $t_{K+1}=T$.)\n",
105104
"\n",
106-
"This optimization is solved with dynamic programming, using the [`Dynp`](../user-guide/detection/dynp.md) class. (More information in the section [What is change point detection?](/what-is-cpd) and the [User guide](/user-guide).)"
105+
"where \\( \\bar{y}_{t_k..t_{k+1}} \\) is the empirical mean of the sub-signal \\( y_{t_k}, y_{t_k+1},\\dots,y_{t_{k+1}-1} \\).\n",
106+
"(By convention \\( t_0=0 \\) and \\( t_{K+1}=T \\).)\n",
107+
"\n",
108+
"This optimization is solved with dynamic programming, using the [`Dynp`](../user-guide/detection/dynp.md) class. (More information in the section [What is change point detection?](/what-is-cpd) and the [User guide](/user-guide).)\n"
107109
]
108110
},
109111
{

docs/getting-started/basic-usage.ipynb

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"Note that the first four element are change point indexes while the last is simply the number of samples.\n",
6969
"(This is a technical convention so that functions in `ruptures` always know the length of the signal at hand.)\n",
7070
"\n",
71-
"It is also possible to plot our $\\mathbb{R}^3$-valued signal along with the true change points with the `rpt.display` function.\n",
71+
"It is also possible to plot our \\(\\mathbb{R}^3\\)-valued signal along with the true change points with the `rpt.display` function.\n",
7272
"In the following image, the color changes whenever the mean of the signal shifts."
7373
]
7474
},
@@ -88,22 +88,24 @@
8888
"## Change point detection\n",
8989
"We can now perform change point detection, meaning that we find the indexes where the signal mean changes.\n",
9090
"To that end, we minimize the sum of squared errors when approximating the signal by a piecewise constant signal.\n",
91-
"Formally, for a signal $y_0,y_1,\\dots,y_{T-1}$ ($T$ samples), we solve the following optimization problem, over all possible change positions $t_1<t_2<\\dots<t_K$ (where the number $K$ of changes is defined by the user):\n",
91+
"Formally, for a signal \\( y_0 , y_1 , \\dots , y_{T-1} \\) (\\( T \\) samples), we solve the following optimization problem, over all possible change positions \\( t_1 < t_2 < \\dots < t_K \\)\n",
92+
"where the number \\( K \\) of changes is defined by the user:\n",
9293
"\n",
93-
"$$\n",
94-
"\\hat{t}_1, \\hat{t}_2,\\dots,\\hat{t}_K = \\arg\\min_{t_1,\\dots,t_K} V(t_1,t_2,\\dots,t_K)\n",
95-
"$$\n",
94+
"\\[\n",
95+
" \\hat{t}_1, \\hat{t}_2,\\dots,\\hat{t}_K = \\arg\\min_{t_1,\\dots,t_K} V(t_1,t_2,\\dots,t_K)\n",
96+
"\\]\n",
9697
"\n",
9798
"with\n",
9899
"\n",
99-
"$$\n",
100-
"V(t_1,t_2,\\dots,t_K) := \\sum_{k=0}^K\\sum_{t=t_k}^{t_{k+1}-1} \\|y_t-\\bar{y}_{t_k..t_{k+1}}\\|^2\n",
101-
"$$\n",
100+
"\\[\n",
101+
" V(t_1,t_2,\\dots,t_K) := \\sum_{k=0}^K\\sum_{t=t_k}^{t_{k+1}-1} \\|y_t-\\bar{y}_{t_k..t_{k+1}}\\|^2\n",
102+
"\\]\n",
102103
"\n",
103-
"where $\\bar{y}_{t_k..t_{k+1}}$ is the empirical mean of the sub-signal $y_{t_k}, y_{t_k+1},\\dots,y_{t_{k+1}-1}$.\n",
104-
"(By convention $t_0=0$ and $t_{K+1}=T$.)\n",
105104
"\n",
106-
"This optimization is solved with dynamic programming, using the [`Dynp`](../user-guide/detection/dynp.md) class. (More information in the section [What is change point detection?](/what-is-cpd) and the [User guide](/user-guide).)"
105+
"where \\( \\bar{y}_{t_k..t_{k+1}} \\) is the empirical mean of the sub-signal \\( y_{t_k}, y_{t_k+1},\\dots,y_{t_{k+1}-1} \\).\n",
106+
"(By convention \\( t_0=0 \\) and \\( t_{K+1}=T \\).)\n",
107+
"\n",
108+
"This optimization is solved with dynamic programming, using the [`Dynp`](../user-guide/detection/dynp.md) class. (More information in the section [What is change point detection?](/what-is-cpd) and the [User guide](/user-guide).)\n"
107109
]
108110
},
109111
{

docs/javascripts/mathjax.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
window.MathJax = {
2+
tex: {
3+
inlineMath: [["\\(", "\\)"]],
4+
displayMath: [["\\[", "\\]"]],
5+
processEscapes: true,
6+
processEnvironments: true
7+
},
8+
options: {
9+
ignoreHtmlClass: ".*|",
10+
processHtmlClass: "arithmatex"
11+
}
12+
};
13+
14+
document$.subscribe(() => {
15+
MathJax.startup.output.clearCache()
16+
MathJax.typesetClear()
17+
MathJax.texReset()
18+
MathJax.typesetPromise()
19+
})

mkdocs.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ plugins:
1010
- ruptures
1111
handlers:
1212
python:
13-
selection:
13+
options:
1414
filters:
1515
- "!^_" # exclude all members starting with _
1616
- "^__init__$" # but always include __init__ modules and methods
@@ -124,6 +124,7 @@ theme:
124124
- navigation.tabs
125125
- search.highlight
126126
extra_javascript:
127-
- javascripts/config.js
127+
- javascripts/mathjax.js
128128
- https://polyfill.io/v3/polyfill.min.js?features=es6
129129
- https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
130+
- https://unpkg.com/mathjax@3/es5/tex-mml-chtml.js

0 commit comments

Comments
 (0)