目錄javascript
[TOC]
出如今隨筆頁面的開始處,能夠幫你顯示目錄,而無需本身配置javascript,但對比下,和本身配置的略有不一樣,自定義的有 Back to the top
,Go to page bottom
,目錄編號
php
<style type="text/css"> #cnblogs_post_body { color: black; font: 0.875em/1.5em "微軟雅黑" , "PTSans" , "Arial" ,sans-serif; font-size: 16px; } #cnblogs_post_body h2 { background: #2B6695; border-radius: 6px 6px 6px 6px; box-shadow: 0 0 0 1px #5F5A4B, 1px 1px 6px 1px rgba(10, 10, 0, 0.5); color: #FFFFFF; font-family: "微軟雅黑" , "宋體" , "黑體" ,Arial; font-size: 17px; font-weight: bold; height: 25px; line-height: 25px; margin: 18px 0 !important; padding: 8px 0 5px 5px; text-shadow: 2px 2px 3px #222222; } #cnblogs_post_body h3{ background: #2B6600; border-radius: 6px 6px 6px 6px; box-shadow: 0 0 0 1px #5F5A4B, 1px 1px 6px 1px rgba(10, 10, 0, 0.5); color: #FFFFFF; font-family: "微軟雅黑" , "宋體" , "黑體" ,Arial; font-size: 13px; font-weight: bold; height: 24px; line-height: 23px; margin: 12px 0 !important; padding: 5px 0 5px 20px; text-shadow: 2px 2px 3px #222222; } #cnblogs_post_body a { color: #21759b; transition-delay: 0s; transition-duration: 0.4s; transition-property: all; transition-timing-function: linear; } #cnblogs_post_body a:hover{ margin-left: 10px } #navCategory a{ display: block; transition: all 1s; } #navCategory a:hover{ margin-left: 10px } #blog-sidecolumn a{ display: block; transition:all 1s; } #blog-sidecolumn a:hover{ margin-left: 10px } #sidebar_toptags li a{ float:left; } #TopViewPostsBlock li a{ margin-left: 5px; } #cnblogs_post_body a{ display: inline-block; transition:all 1s; } </style>
<script language="javascript" type="text/javascript"> // Generate a directory index list // ref: http://www.cnblogs.com/wangqiguo/p/4355032.html // ref: https://www.cnblogs.com/xuehaoyue/p/6650533.html // modified by: keyshaw function GenerateContentList() { var mainContent = $('#cnblogs_post_body'); //If your chapter title isn't `h2`, You just replace the h2 here. var h2_list = $('#cnblogs_post_body h2'); // var go_to_bottom = '<div style="text-align: right;"><a href="#_page_bottom" style="color:#f68a33">Go to page bottom</a></div>'; var bottom_label = '<div style="text-align: right;"><a href="#_labelTop" style="color:#f68a33">Back to the top</a><a name="_page_bottom"></a></div>' if(mainContent.length < 1) return; if(h2_list.length>0) { var content = '<div style="text-align: right;"><a href="#_page_bottom" style="color:#f68a33">Go to page bottom</a></div><a name="_labelTop"></a>'; content += '<div id="navCategory" style="color:#152e97;">'; // coutent += '<div style="text-align: right;"><a href="#_page_bottom" style="color:#f68a33">Go to page bottom</a></div>' content += '<h1 style="font-size:16px;background: #f68a33;border-radius: 6px 6px 6px 6px;box-shadow: 0 0 0 1px #5F5A4B, 1px 1px 6px 1px rgba(10, 10, 0, 0.5);color: #FFFFFF;font-size: 17px;font-weight: bold;height: 25px;line-height: 25px;margin: 18px 0 !important;padding: 8px 0 5px 30px;"><b>Catalogue</b></h1>'; // ol - ordered; ul - unordered content += '<ol>'; for(var i=0; i<h2_list.length; i++) { // add 'Back to the top' before h2 var go_to_top_2 = '<div style="text-align: right;"><a href="#_labelTop" style="color:#f68a33">Back to the top</a><a name="_label' + i + '"></a></div>'; $(h2_list[i]).before(go_to_top_2); var h3_list = $(h2_list[i]).nextAll("h3"); var li3_content = ''; for(var j=0; j<h3_list.length; j++) { var tmp_3 = $(h3_list[j]).prevAll('h2').first(); if(!tmp_3.is(h2_list[i])) break; var go_to_top_3 = '<div style="text-align: right;"><a href="#_labelTop" style="color:#f68a33">Back to the top</a><a name="_label' + i + '_' + j + '"></a></div>'; $(h3_list[j]).before(go_to_top_3); // li3_content += '<li><a href="#_label' + i + '_' + j + '"style="font-size:12px;color:#2b6695;">' + $(h3_list[j]).text() + '</a></li>'; var li4_content = ''; var h4_list = $(h3_list[j]).nextAll("h4"); for(var k=0; k<h4_list.length; k++) { var tmp_4 = $(h4_list[k]).prevAll('h3').first(); if(!tmp_4.is(h3_list[j])) break; var go_to_top_4 = '<div style="text-align: right;"><a href="#_labelTop" style="color:#f68a33">Back to the top</a><a name="_label' + i + '_' + j + '_' + k + '"></a></div>'; $(h4_list[k]).before(go_to_top_4); li4_content += '<li><a href="#_label' + i + '_' + j + '_' + k + '"style="font-size:12px;color:#2b6695;">' + $(h4_list[k]).text() + '</a></li>'; } if(li4_content.length > 0) li3_content += '<li><a href="#_label' + i + '_' + j + '"style="font-size:12px;color:#2b6695;">' + $(h3_list[j]).text() + '</a><ul>' + li4_content + '</ul></li>'; else li3_content += '<li><a href="#_label' + i + '_' + j + '"style="font-size:12px;color:#2b6695;">' + $(h3_list[j]).text() + '</a></li>'; } var li2_content = ''; if(li3_content.length > 0) li2_content = '<li><a href="#_label' + i + '"style="font-size:12px;color:#2b6695;">' + $(h2_list[i]).text() + '</a><ul>' + li3_content + '</ul></li>'; else li2_content = '<li><a href="#_label' + i + '"style="font-size:12px;color:#2b6695;">' + $(h2_list[i]).text() + '</a></li>'; content += li2_content; } content += '</ol>'; content += '</div><p> </p>'; content += '<hr />'; // $(mainContent[0]).prepend(go_to_bottom); $(mainContent[0]).prepend(content); $(mainContent[0]).append(bottom_label); } } GenerateContentList(); </script>
主標題 ===
副標題 ---
# h1,一級標題
css
## h2,二級標題
html
### h3,三級標題
前端
#### h4,四級標題
java
##### h5,五級標題
markdown
###### h6,六級標題
前端工程師
><space><space><enter> 這是一段註釋 <space><space><enter> **a** : 這是一段註釋 <space><space><enter> **b** : 這是一段註釋
app
這是一段註釋
a : 這是一段註釋
b : 這是一段註釋
>這是一段註釋 **a** : 這是一段註釋 **b** : 這是一段註釋
這是一段註釋
a : 這是一段註釋
b : 這是一段註釋ide
$\underset{\sim}{A}$
: \(\underset{\sim}{Λ}\)
$\widehat{y}$
: \(\widehat{y}\)
<u>我被下劃線了</u>
: 我被下劃線了
~~我被刪除線了~~
: 我被刪除線了
$\mathrm{d}a$
: \(\mathrm{d}a\)
$da$
: \(da\)
$( \big( \Big( \bigg( \Bigg($
: \(( \big( \Big( \bigg( \Bigg(\)
useful links for your LaTeX:
https://en.wikibooks.org/wiki/LaTeX/Mathematics
https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference
https://zh.numberempire.com/latexequationeditor.php
   here      here here
here
here
here
<ul> <li>無序列表1</li> <li>無序列表2</li> <li>無序列表3</li> </ul>
* 無序列表1 * 無序列表2 * 無序列表3
+ 無序列表4 + 無序列表5 + 無序列表6
- 無序列表7 - 無序列表8 - 無序列表9
* 呆萌小二郎 * 23歲 * 前端工程師 喜歡看書,擼代碼,寫博客... * 呆萌小二郎2 * 嘻嘻哈哈 * 開心 * 呆萌小二郎3
<ol> <li>有序列表1</li> <li>有序列表2</li> <li>有序列表3</li> </ol>
1. 有序列表1 2. 有序列表2 3. 有序列表3
1. 有序列表1 1. 有序列表2 1. 有序列表3
[呆萌小二郎博客跳轉連接](http://blog.zhouminghang.xyz)
呆萌小二郎博客跳轉連接
度娘一下,你就知道: <http://www.baidu.com>
度娘一下,你就知道: http://www.baidu.com
<http://blog.zhouminghang.xyz>
http://blog.zhouminghang.xyz

*斜體寫法1* 和 _斜體寫法2_
斜體寫法1 和 斜體寫法2
**加粗寫法1** 和 __加粗寫法2__
加粗寫法1 和 加粗寫法2
* * *
***
*****************
- - -
-----------------
---
`單行代碼`
單行代碼
```
多行代碼(
\這裏用來轉義符號,
相似於html中單雙引號多層嵌套要轉義
)
```
多行代碼( \這裏用來轉義符號, 相似於html中單雙引號多層嵌套要轉義 )
不使用 \begin{align}
和 \end{align}
也能夠爲公式添加標號,能夠使用 \tag{n}
$aaa \tag{1}$ $bbb \tag{2}$
\(aaa \tag{1}\)
\(bbb \tag{2}\)
However, this doesn't give the correct result.
LaTeX doesn't respect the white-space left in the code to signify that the y and the dx are independent entities.
Instead, it lumps them altogether.
A \quad
would clearly be overkill in this situation—what is needed are some small spaces to be utilized in this type of instance, and that's what LaTeX provides:
Command|Description| Size :---|---|---: \\,|small space|3/18 of a quad \\:|medium space|4/18 of a quad \\;|large space|5/18 of a quad \\!|negative space|-3/18 of a quad
Command | Description | Size |
---|---|---|
\, | small space | 3/18 of a quad |
\: | medium space | 4/18 of a quad |
\; | large space | 5/18 of a quad |
\! | negative space | -3/18 of a quad |
**Expected Output**: <table style="width:100%"> <tr> <td> **sigmoid_derivative([1,2,3])**</td> <td> [ 0.19661193 0.10499359 0.04517666] </td> </tr> </table>
Expected Output:
sigmoid_derivative([1,2,3]) | [ 0.19661193 0.10499359 0.04517666] |
$$ \begin{align} & \underset{w,b}{\mathrm{max}} \;\; \underset{i}{\mathrm{min}} \;\; \frac{2}{||w||} | w^{\top} x_i + b |, \\ & \mathrm{s.t.} \;\;y_i(w^{\top}x_i + b) > 0, \; i = 1,2,...,m. \nonumber \end{align} $$
\[ \begin{align} & \underset{w,b}{\mathrm{max}} \;\; \underset{i}{\mathrm{min}} \;\; \frac{2}{||w||} | w^{\top} x_i + b |, \\ & \mathrm{s.t.} \;\;y_i(w^{\top}x_i + b) > 0, \; i = 1,2,...,m. \nonumber \end{align} \]
$$ \begin{align} h(x_i)= \begin{cases} 1 & \text{若 }y_i=1; \\ -1 & \text{若 }y_i=-1. \\ \end{cases} \end{align} $$
\(\begin{align}h(x_i)=\begin{cases} 1 & \text{若 }y_i=1; \\ -1 & \text{若 }y_i=-1. \\\end{cases}\end{align}\)
$$ \begin{align} h(x_i) := \mathrm{sign}(w^T x_i + b), \text{ 其中 } w_i \in \mathbb{R}^d,b \in \mathbb{R}. \end{align} $$
\(\begin{align}h(x_i) := \mathrm{sign}(w^T x_i + b), \text{ 其中 } w_i \in \mathbb{R}^d,b \in \mathbb{R}.\end{align}\)
$$ \begin{align} \forall_{i.} \;\; y_i(w^T x_i + b) > 0 \end{align} $$
\(\begin{align} \forall_{i.} \;\; y_i(w^T x_i + b) > 0 \end{align}\)
$$ \begin{align} y_i h(x_i) = 1 \Leftrightarrow y_i \mathrm{sign}(w^T x_i + b) = 1 \Leftrightarrow y_i(w^T x_i + b) > 0 \end{align} $$
\(\begin{align} y_i h(x_i) = 1 \Leftrightarrow y_i \mathrm{sign}(w^T x_i + b) = 1 \Leftrightarrow y_i(w^T x_i + b) > 0 \end{align}\)
$$ \begin{align} \frac{1}{||w||} | w^{\top} p + b | \end{align} $$
\(\begin{align} \frac{1}{||w||} | w^{\top} p + b |\end{align}\)
$$ \begin{align} w^{\top}(x_1-x_2) = w^{\top}x_1-w^{\top}x_2=(-b)-(-b)=0, \end{align} $$
\(\begin{align} w^{\top}(x_1-x_2) = w^{\top}x_1-w^{\top}x_2=(-b)-(-b)=0,\end{align}\)
\(w \perp (x_1 - x_2)\)
$$ \begin{align} \mathrm{proj}_w(p-x) &= ||p-x|| \cdot |\cos (w, p - x)| \nonumber\\ &= ||p-x|| \cdot \frac{|w^{\top}(p-x)|}{||w|| \cdot ||p-x||} \nonumber \\ &= \frac{1}{||w||} |w^{\top}p - w^{\top}x| \nonumber \\ &= \frac{1}{||w||} | w^{\top}p + b | \end{align} $$
\(\begin{align} \mathrm{proj}_w(p-x) &= ||p-x|| \cdot |\cos (w, p - x)| \nonumber\\ &= ||p-x|| \cdot \frac{|w^{\top}(p-x)|}{||w|| \cdot ||p-x||} \nonumber \\ &= \frac{1}{||w||} |w^{\top}p - w^{\top}x| \nonumber \\ &= \frac{1}{||w||} | w^{\top}p + b | \end{align}\)
$$ \gamma := 2 \; \underset{i}{\mathrm{min}} \frac{1}{||w||} | w^{\top} x_i + b | $$
\(\gamma := 2 \; \underset{i}{\mathrm{min}} \frac{1}{||w||} | w^{\top} x_i + b |\)
$$ \begin{align} & \underset{u}{\mathrm{min}} \;\; \frac{1}{2} u^{\top}Qu+t^{\top}u \\ & \mathrm{s.t.} \;\; c_i^{\top} u \geq d_i, \; i = 1,2,...,m. \nonumber \end{align} $$
\[ \begin{align} & \underset{u}{\mathrm{min}} \;\; \frac{1}{2} u^{\top}Qu+t^{\top}u \\ & \mathrm{s.t.} \;\; c_i^{\top} u \geq d_i, \; i = 1,2,...,m. \nonumber \end{align} \]
$$ \begin{align} & \underset{u}{\mathrm{min}} \;\; \frac{1}{2} u^{\top}Qu+t^{\top}u \\ & \mathrm{s.t.} \;\; c_i^{\top} u \geq d_i, \; i = 1,2,...,m. \nonumber \end{align} $$
\[ \begin{align} & \underset{u}{\mathrm{min}} \;\; \frac{1}{2} u^{\top}Qu+t^{\top}u \\ & \mathrm{s.t.} \;\; c_i^{\top} u \geq d_i, \; i = 1,2,...,m. \nonumber \end{align} \]
$$ \begin{align} \frac{2}{||rw^*||} | (rw^*)^{\top} x_i + rb^* | = \frac{2}{||w^*||} | w^{*\top} x_i + b^* |, \\ y_i \big( (rw^*)^{\top} x_i + rb^* \big) > 0 \Leftrightarrow y_i (w^{*\top} x_i + b^*)>0. \end{align} $$
\[ \begin{align} \frac{2}{||rw^*||} | (rw^*)^{\top} x_i + rb^* | = \frac{2}{||w^*||} | w^{*\top} x_i + b^* |, \\ y_i \big( (rw^*)^{\top} x_i + rb^* \big) > 0 \Leftrightarrow y_i (w^{*\top} x_i + b^*)>0. \end{align} \]
$$ \begin{align} \underset{i}{\mathrm{min}} \; | w^{\top} x_i + b | = 1. \end{align} $$
\[ \begin{align} \underset{i}{\mathrm{min}} \; | w^{\top} x_i + b | = 1. \end{align} \]
$$ \begin{align} & \underset{w, b}{\mathrm{min}} \;\; \frac{1}{2} w^{\top} w \\ & \mathrm{s.t.} \;\; y_i (w^{\top} x_i +b ) \geq 1, \; i = 1,2,...,m. \nonumber \end{align} $$
\[ \begin{align} & \underset{w, b}{\mathrm{min}} \;\; \frac{1}{2} w^{\top} w \\ & \mathrm{s.t.} \;\; y_i (w^{\top} x_i +b ) \geq 1, \; i = 1,2,...,m. \nonumber \end{align} \]
$$ \begin{align} & \underset{w, b}{\mathrm{min}} \;\; \frac{1}{2} w^{\top} w \\ & \mathrm{s.t.} \;\; \underset{i}{\mathrm{min}} \;\; y_i (w^{\top} x_i +b ) = 1. \nonumber \end{align} $$
\[ \begin{align} & \underset{w, b}{\mathrm{min}} \;\; \frac{1}{2} w^{\top} w \\ & \mathrm{s.t.} \;\; \underset{i}{\mathrm{min}} \;\; y_i (w^{\top} x_i +b ) = 1. \nonumber \end{align} \]
$$ \begin{align} \underset{w, b}{\mathrm{argmin}} \;\; \frac{1}{2} w^{\top} w & = \underset{w, b}{\mathrm{argmin}} \;\; \frac{1}{2} ||w|| \nonumber\\ & = \underset{w, b}{\mathrm{argmax}} \;\; \frac{2}{||w||} \cdot 1 \nonumber\\ & = \underset{w, b}{\mathrm{argmax}} \;\; \Big( \underset{i}{\mathrm{min}} \; \frac{2}{||w||} y_i (w^{\top} x_i + b) \Big) \nonumber\\ & = \underset{w, b}{\mathrm{argmax}} \;\; \Big( \underset{i}{\mathrm{min}} \; \frac{2}{||w||} |w^{\top} x_i + b| \Big) \end{align} $$
\[ \begin{align} \underset{w, b}{\mathrm{argmin}} \;\; \frac{1}{2} w^{\top} w & = \underset{w, b}{\mathrm{argmin}} \;\; \frac{1}{2} ||w|| \nonumber\\ & = \underset{w, b}{\mathrm{argmax}} \;\; \frac{2}{||w||} \cdot 1 \nonumber\\ & = \underset{w, b}{\mathrm{argmax}} \;\; \Big( \underset{i}{\mathrm{min}} \; \frac{2}{||w||} y_i (w^{\top} x_i + b) \Big) \nonumber\\ & = \underset{w, b}{\mathrm{argmax}} \;\; \Big( \underset{i}{\mathrm{min}} \; \frac{2}{||w||} |w^{\top} x_i + b| \Big) \end{align} \]
$$ \begin{align} u := \begin{bmatrix} w \\ b \end{bmatrix}, Q := \begin{bmatrix} I&0\\0&0 \end{bmatrix}, t := 0, \\ c_i := y_i \begin{bmatrix} x_i \\ 1 \end{bmatrix}, d_i := 1, \end{align} $$
\[ \begin{align} u := \begin{bmatrix} w \\ b \end{bmatrix}, Q := \begin{bmatrix} I&0\\0&0 \end{bmatrix}, t := 0, \\ c_i := y_i \begin{bmatrix} x_i \\ 1 \end{bmatrix}, d_i := 1, \end{align} \]
$$ \begin{align} \underset{u}{\mathrm{min}} &\;\; f(u) &\\ \mathrm{s.t.} &\;\; g_i (u) \leq 0, &i = 1,2,...,m, \nonumber\\ & \;\; h_j (u) = 0, &j = 1,2,...,n, \nonumber \end{align} $$
\[ \begin{align} \underset{u}{\mathrm{min}} &\;\; f(u) &\\ \mathrm{s.t.} &\;\; g_i (u) \leq 0, &i = 1,2,...,m, \nonumber\\ & \;\; h_j (u) = 0, &j = 1,2,...,n, \nonumber \end{align} \]
$$ \begin{align} \mathcal{L}(u,\alpha,\beta) := f(u) + \sum\limits_{i=1}^{m} \alpha_i g_i (u) + \sum\limits_{j=1}^{n} \beta_j h_j (u) \end{align} $$
\[ \begin{align} \mathcal{L}(u,\alpha,\beta) := f(u) + \sum\limits_{i=1}^{m} \alpha_i g_i (u) + \sum\limits_{j=1}^{n} \beta_j h_j (u) \end{align} \]
$$ \begin{align} \underset{u}{\mathrm{min}} \;\; \underset{\alpha, \beta}{\mathrm{max}} \;\;& \mathcal{L} (u, \alpha, \beta) \\ \mathrm{s.t.} \;\;\;\;\;\;& \alpha_i \geq 0, \;\; i = 1,2,...,m. \nonumber \end{align} $$
\[ \begin{align} \underset{u}{\mathrm{min}} \;\; \underset{\alpha, \beta}{\mathrm{max}} \;\;& \mathcal{L} (u, \alpha, \beta) \\ \mathrm{s.t.} \;\;\;\;\;\;& \alpha_i \geq 0, \;\; i = 1,2,...,m. \nonumber \end{align} \]
$$ \begin{align} & \underset{u}{\mathrm{min}} \;\; \underset{\alpha, \beta}{\mathrm{max}} \;\; \mathcal{L} (u, \alpha, \beta) \nonumber \\ = & \underset{u}{\mathrm{min}} \Bigg( f(u) + \underset{\alpha, \beta}{\mathrm{max}} \Big( \sum\limits_{i=1}^{m} \alpha_i g_i (u) + \sum\limits_{j=1}^{n} \beta_j h_j (u) \Big)\Bigg) \nonumber \\ = & \underset{u}{\mathrm{min}} \Bigg( f(u) + \begin{cases} 0 & \text{若 } u \text{ 知足約束;} \\ \infty & \text{不然} \end{cases} \Bigg) \nonumber \\ = & \underset{u}{\mathrm{min}} \; f(u), \text{ 且 } u \text{ 知足約束,} \end{align} $$
\[ \begin{align} & \underset{u}{\mathrm{min}} \;\; \underset{\alpha, \beta}{\mathrm{max}} \;\; \mathcal{L} (u, \alpha, \beta) \nonumber \\ = & \underset{u}{\mathrm{min}} \Bigg( f(u) + \underset{\alpha, \beta}{\mathrm{max}} \Big( \sum\limits_{i=1}^{m} \alpha_i g_i (u) + \sum\limits_{j=1}^{n} \beta_j h_j (u) \Big)\Bigg) \nonumber \\ = & \underset{u}{\mathrm{min}} \Bigg( f(u) + \begin{cases} 0 & \text{若 } u \text{ 知足約束;} \\ \infty & \text{不然} \end{cases} \Bigg) \nonumber \\ = & \underset{u}{\mathrm{min}} \; f(u), \text{ 且 } u \text{ 知足約束,} \end{align} \]
$$ \begin{align} \underset{\alpha, \beta}{\mathrm{max}} \;\; \underset{u}{\mathrm{min}} \;\;& \mathcal{L} (u, \alpha, \beta) \\ \mathrm{s.t.} \;\;\;\;\;\;& \alpha_i \geq 0, \;\; i = 1,2,...,m. \nonumber \end{align} $$
\[ \begin{align} \underset{\alpha, \beta}{\mathrm{max}} \;\; \underset{u}{\mathrm{min}} \;\;& \mathcal{L} (u, \alpha, \beta) \\ \mathrm{s.t.} \;\;\;\;\;\;& \alpha_i \geq 0, \;\; i = 1,2,...,m. \nonumber \end{align} \]
$$ \begin{align} \underset{\alpha, \beta}{\mathrm{max}} \;\; \underset{u}{\mathrm{min}} \;\; \mathcal{L} (u, \alpha, \beta) \;\; \leq \;\; \underset{u}{\mathrm{min}} \;\; \underset{\alpha, \beta}{\mathrm{max}} \;\; \mathcal{L} (u, \alpha, \beta) \end{align} $$
\[ \begin{align} \underset{\alpha, \beta}{\mathrm{max}} \;\; \underset{u}{\mathrm{min}} \;\; \mathcal{L} (u, \alpha, \beta) \;\; \leq \;\; \underset{u}{\mathrm{min}} \;\; \underset{\alpha, \beta}{\mathrm{max}} \;\; \mathcal{L} (u, \alpha, \beta) \end{align} \]
$$ \begin{align} \mathcal{L}(w,b,\alpha) := \frac{1}{2}w^{\top}w + \sum\limits_{i=1}^{m}\alpha_i \big(1- y_i (w^{\top} x_i + b) \big) \end{align} $$
\[ \begin{align} \mathcal{L}(w,b,\alpha) := \frac{1}{2}w^{\top}w + \sum\limits_{i=1}^{m}\alpha_i \big(1- y_i (w^{\top} x_i + b) \big) \end{align} \]
$$ \begin{align} \underset{\alpha}{\mathrm{max}} \; \underset{w,b}{\mathrm{min}} \; & \frac{1}{2}w^{\top}w + \sum\limits_{i=1}^{m}\alpha_i \big(1- y_i (w^{\top} x_i + b) \big) \\ \mathrm{s.t.} \;\;\;\;\;\; & \alpha_i \geq 0, \; i = 1,2,...,m. \nonumber \end{align} $$
\[ \begin{align} \underset{\alpha}{\mathrm{max}} \; \underset{w,b}{\mathrm{min}} \; & \frac{1}{2}w^{\top}w + \sum\limits_{i=1}^{m}\alpha_i \big(1- y_i (w^{\top} x_i + b) \big) \\ \mathrm{s.t.} \;\;\;\;\;\; & \alpha_i \geq 0, \; i = 1,2,...,m. \nonumber \end{align} \]
$$ \begin{align} \underset{\alpha}{\mathrm{min}} \;\; & \frac{1}{2} \sum\limits_{i=1}^{m} \sum\limits_{j=1}^{m} \alpha_i \alpha_j y_i y_j x_i^{\top} x_j - \sum\limits_{i=1}^{m}\alpha_i \\ \mathrm{s.t.} \;\;\; & \sum\limits_{i=1}^{m} \alpha_i y_i = 0, \nonumber \\ & \alpha_i \geq 0, \; i = 1,2,...,m. \nonumber \end{align} $$
\[ \begin{align} \underset{\alpha}{\mathrm{min}} \;\; & \frac{1}{2} \sum\limits_{i=1}^{m} \sum\limits_{j=1}^{m} \alpha_i \alpha_j y_i y_j x_i^{\top} x_j - \sum\limits_{i=1}^{m}\alpha_i \\ \mathrm{s.t.} \;\;\; & \sum\limits_{i=1}^{m} \alpha_i y_i = 0, \nonumber \\ & \alpha_i \geq 0, \; i = 1,2,...,m. \nonumber \end{align} \]
$$ \begin{align} \frac{\partial \mathcal{L}}{\partial w} = 0 \Leftrightarrow & w = \sum\limits_{i=1}^{m} \alpha_i y_i x_i, \\ \frac{\partial \mathcal{L}}{\partial b} = 0 \Leftrightarrow & \sum\limits_{i=1}^{m} \alpha_i y_i. \end{align} $$
\[ \begin{align} \frac{\partial \mathcal{L}}{\partial w} = 0 \Leftrightarrow & w = \sum\limits_{i=1}^{m} \alpha_i y_i x_i, \\ \frac{\partial \mathcal{L}}{\partial b} = 0 \Leftrightarrow & \sum\limits_{i=1}^{m} \alpha_i y_i. \end{align} \]
$$ \begin{align} & u:=\alpha,\;\mathcal{Q}:=[y_i y_j x_i^{\top} x_j]_{m \times m},\;t:=-1,\\ & c_i:=e_i,\;d_i:=0,\; i=1,2,...,m,\\ & c_{m+1}:=[y_1\;y_2\; \cdots \; y_m]^{\top} , \; d_{m+1}:=0,\\ & c_{m+2}:=-[y_1\;y_2\; \cdots \; y_m]^{\top}, \; d_{m+2}:=0, \end{align} $$
\[ \begin{align} & u:=\alpha,\;\mathcal{Q}:=[y_i y_j x_i^{\top} x_j]_{m \times m},\;t:=-1,\\ & c_i:=e_i,\;d_i:=0,\; i=1,2,...,m,\\ & c_{m+1}:=[y_1\;y_2\; \cdots \; y_m]^{\top} , \; d_{m+1}:=0,\\ & c_{m+2}:=-[y_1\;y_2\; \cdots \; y_m]^{\top}, \; d_{m+2}:=0, \end{align} \]
$$ \begin{align} u:=\begin{bmatrix} w \\ b \end{bmatrix}, \;\; g_i(u):= 1-y_i {\begin{bmatrix} x_i \\ 1 \end{bmatrix}}^{\top} u, \end{align} $$
\[ \begin{align} u:=\begin{bmatrix} w \\ b \end{bmatrix}, \;\; g_i(u):= 1-y_i {\begin{bmatrix} x_i \\ 1 \end{bmatrix}}^{\top} u, \end{align} \]
$$ \begin{align} w = & \sum\limits_{i=1}^{m}\alpha_i y_i x_i \nonumber \\ = & \sum\limits_{i:\;\alpha_i = 0}^{m} 0 \cdot y_i x_i + \sum\limits_{i:\;\alpha_i>0}^{m}\alpha_i y_i x_i \nonumber \\ = & \sum\limits_{i \in SV}^{}\alpha_i y_i x_i, \end{align} $$
\[ \begin{align} w = & \sum\limits_{i=1}^{m}\alpha_i y_i x_i \nonumber \\ = & \sum\limits_{i:\;\alpha_i = 0}^{m} 0 \cdot y_i x_i + \sum\limits_{i:\;\alpha_i>0}^{m}\alpha_i y_i x_i \nonumber \\ = & \sum\limits_{i \in SV}^{}\alpha_i y_i x_i, \end{align} \]
$$ \begin{align} & y_s(w^{\top} x_s + b) = 1, \text{ 則} \nonumber \\ & b = y_s - w^{\top} x_s = y_s - \sum\limits_{i \in SV} \alpha_i y_i x_i^{\top} x_s. \end{align} $$
\[ \begin{align} & y_s(w^{\top} x_s + b) = 1, \text{ 則} \nonumber \\ & b = y_s - w^{\top} x_s = y_s - \sum\limits_{i \in SV} \alpha_i y_i x_i^{\top} x_s. \end{align} \]
$$ \begin{align} h(x) = \mathrm{sign} \Big( \sum\limits_{i \in SV} \alpha_i y_i x_i^{\top} x + b \Big). \end{align} $$
\[ \begin{align} h(x) = \mathrm{sign} \Big( \sum\limits_{i \in SV} \alpha_i y_i x_i^{\top} x + b \Big). \end{align} \]
$$ \begin{align} \underset{w,b}{\mathrm{min}} \;\; & \frac{1}{2} w^{\top} w \\ \mathrm{s.t.} \;\; & y_i(w^{\top}\phi(x_i) + b)\geq1,\;i=1,2,...,m; \nonumber \\ \nonumber \\ \nonumber \\ \underset{\alpha}{\mathrm{min}} \;\; & \frac{1}{2} \sum\limits_{i=1}^{m}\sum\limits_{j=1}^{m}\alpha_i\alpha_jy_iy_j\phi(x_i)^{\top}\phi(x_j)-\sum\limits_{i=1}^{m}\alpha_i \\ \mathrm{s.t.} \;\; & \sum\limits_{i=1}^{m}\alpha_iy_i = 0, \nonumber \\ &\alpha_i \geq 0, \; i=1,2,...,m. \nonumber \end{align} $$
\[ \begin{align} \underset{w,b}{\mathrm{min}} \;\; & \frac{1}{2} w^{\top} w \\ \mathrm{s.t.} \;\; & y_i(w^{\top}\phi(x_i) + b)\geq1,\;i=1,2,...,m; \nonumber \\ \nonumber \\ \nonumber \\ \underset{\alpha}{\mathrm{min}} \;\; & \frac{1}{2} \sum\limits_{i=1}^{m}\sum\limits_{j=1}^{m}\alpha_i\alpha_jy_iy_j\phi(x_i)^{\top}\phi(x_j)-\sum\limits_{i=1}^{m}\alpha_i \\ \mathrm{s.t.} \;\; & \sum\limits_{i=1}^{m}\alpha_iy_i = 0, \nonumber \\ &\alpha_i \geq 0, \; i=1,2,...,m. \nonumber \end{align} \]
$\begin{align}\kappa(x_i, x_j)=\phi (x_i)^T \phi (x_j),\end{align}$
\(\begin{align}\kappa(x_i, x_j)=\phi (x_i)^T \phi (x_j),\end{align}\)
$$ \begin{align} \phi : x \mapsto exp(-x^2) \begin{bmatrix} 1\\ \sqrt{\frac{2}{1}}x \\ \sqrt{\frac{2^2}{2!}}x^2 \\ \vdots \end{bmatrix} \end{align} $$
\[ \begin{align} \phi : x \mapsto exp(-x^2) \begin{bmatrix} 1\\ \sqrt{\frac{2}{1}}x \\ \sqrt{\frac{2^2}{2!}}x^2 \\ \vdots \end{bmatrix} \end{align} \]
$$ \begin{align} \kappa(x_i,x_j):=exp\Big(-(x_i - x_j)^2\Big). \end{align} $$
\[ \begin{align} \kappa(x_i,x_j):=exp\Big(-(x_i - x_j)^2\Big). \end{align} \]
$$ \begin{align} \kappa(x_i,x_j) &= exp\Big(-(x_i - x_j)^2\Big) \nonumber \\ &= exp(-x_i^2)exp(-x_j^2)exp(2x_ix_j) \nonumber \\ &= exp(-x_i^2)exp(-x_j^2)\sum\limits_{k=0}^{\infty}\frac{(2x_ix_j)^k}{k!} \nonumber \\ &= \sum\limits_{k=0}^{\infty}\Bigg(exp(-x_i^2)\sqrt{\frac{2^k}{k!}}x_i^k\Bigg)\Bigg(exp(-x_j^2)\sqrt{\frac{2^k}{k!}}x_j^k\Bigg) \nonumber \\ &= \phi(x_i)^{\top}\phi(x_j). \end{align} $$
\[ \begin{align} \kappa(x_i,x_j) &= exp\Big(-(x_i - x_j)^2\Big) \nonumber \\ &= exp(-x_i^2)exp(-x_j^2)exp(2x_ix_j) \nonumber \\ &= exp(-x_i^2)exp(-x_j^2)\sum\limits_{k=0}^{\infty}\frac{(2x_ix_j)^k}{k!} \nonumber \\ &= \sum\limits_{k=0}^{\infty}\Bigg(exp(-x_i^2)\sqrt{\frac{2^k}{k!}}x_i^k\Bigg)\Bigg(exp(-x_j^2)\sqrt{\frac{2^k}{k!}}x_j^k\Bigg) \nonumber \\ &= \phi(x_i)^{\top}\phi(x_j). \end{align} \]
$$ \begin{align} K := [\kappa(x_i,x_j)]_{m \times m} \end{align} $$
\[ \begin{align} K := [\kappa(x_i,x_j)]_{m \times m} \end{align} \]
$$ \begin{align} \Phi:=[\phi(x_1)\;\phi(x_2)\;\ldots\;\phi(x_m)] \in \mathbb{R}^{\tilde{d} \times m}, \end{align} $$
\[ \begin{align} \Phi:=[\phi(x_1)\;\phi(x_2)\;\ldots\;\phi(x_m)] \in \mathbb{R}^{\tilde{d} \times m}, \end{align} \]
$$ \begin{align} c_1 \kappa_1(x_i,x_j)+c_2 \kappa_2 (x_i,x_j) = {\begin{bmatrix} \sqrt{c_1}\phi_1(x_i) \\ \sqrt{c_2}\phi_2(x_i) \end{bmatrix}}^{\top} \begin{bmatrix} \sqrt{c_1}\phi_1(x_i) \\ \sqrt{c_2}\phi_2(x_i) \end{bmatrix}\\ \kappa_1(x_i,x_j)\kappa_2(x_i,x_j)=\mathrm{vec}\big(\phi_1(x_i)\phi_2(x_i)^{\top}\big)^{\top}\mathrm{vec}\big(\phi_1(x_j)\phi_2(x_j)^{\top}\big)^{\top},\\ f(x_1)\kappa_1(x_i,x_j)f(x_2)=\big(f(x_i)\phi(x_i)^{\top}\big)^{\top}\big(f(x_j)\phi(x_j)\big). \end{align} $$
\[ \begin{align} c_1 \kappa_1(x_i,x_j)+c_2 \kappa_2 (x_i,x_j) = {\begin{bmatrix} \sqrt{c_1}\phi_1(x_i) \\ \sqrt{c_2}\phi_2(x_i) \end{bmatrix}}^{\top} \begin{bmatrix} \sqrt{c_1}\phi_1(x_i) \\ \sqrt{c_2}\phi_2(x_i) \end{bmatrix}\\ \kappa_1(x_i,x_j)\kappa_2(x_i,x_j)=\mathrm{vec}\big(\phi_1(x_i)\phi_2(x_i)^{\top}\big)^{\top}\mathrm{vec}\big(\phi_1(x_j)\phi_2(x_j)^{\top}\big)^{\top},\\ f(x_1)\kappa_1(x_i,x_j)f(x_2)=\big(f(x_i)\phi(x_i)^{\top}\big)^{\top}\big(f(x_j)\phi(x_j)\big). \end{align} \]
$m+\tilde{d}+1$
\(m+\tilde{d}+1\)
$$ \overbrace{ \left[ \begin{array}{c} ...W^{[1]T}{1}...\ ...W^{[1]T}{2}...\ ...W^{[1]T}{3}...\ ...W^{[1]T}{4}... \end{array} \right] }^{W^{[1]}} * \overbrace{ \left[ \begin{array}{c} x_1\ x_2\ x_3\ \end{array} \right] }^{input} + \overbrace{ \left[ \begin{array}{c} b^{[1]}_1\ b^{[1]}_2\ b^{[1]}_3\ b^{[1]}_4\ \end{array} \right] }^{b^{[1]}} $$
\[ \overbrace{ \left[ \begin{array}{c} ...W^{[1]T}{1}...\ ...W^{[1]T}{2}...\ ...W^{[1]T}{3}...\ ...W^{[1]T}{4}... \end{array} \right] }^{W^{[1]}} * \overbrace{ \left[ \begin{array}{c} x_1\ x_2\ x_3\ \end{array} \right] }^{input} + \overbrace{ \left[ \begin{array}{c} b^{[1]}_1\ b^{[1]}_2\ b^{[1]}_3\ b^{[1]}_4\ \end{array} \right] }^{b^{[1]}} \]
$$ Z^{[1]}= \overbrace{ \begin{bmatrix} \cdots w^{[1]T}_1 \cdots \\ \cdots w^{[1]T}_2 \cdots \\ \cdots w^{[1]T}_3 \cdots \\ \cdots w^{[1]T}_4 \cdots \end{bmatrix} }^{W^{[1]},\; (4 \times 3)} \begin{bmatrix} x_1 \\ x_2 \\ x_3 \end{bmatrix} + \overbrace{ \begin{bmatrix} b^{[1]}_1 \\ b^{[1]}_2 \\ b^{[1]}_3 \\ b^{[1]}_4 \end{bmatrix} }^{b^{[1]},\; (4 \times 1)} = \begin{bmatrix} w^{[1]T}_1 x + b^{[1]}_1 \\ w^{[1]T}_2 x + b^{[1]}_2 \\ w^{[1]T}_3 x + b^{[1]}_3 \\ w^{[1]T}_4 x + b^{[1]}_4 \end{bmatrix} = \underbrace{ \begin{bmatrix} z^{[1]}_1 \\ z^{[1]}_2 \\ z^{[1]}_3 \\ z^{[1]}_4 \end{bmatrix} }_{z^{[1]}} $$
\[ Z^{[1]}= \overbrace{ \begin{bmatrix} \cdots w^{[1]T}_1 \cdots \\ \cdots w^{[1]T}_2 \cdots \\ \cdots w^{[1]T}_3 \cdots \\ \cdots w^{[1]T}_4 \cdots \end{bmatrix} }^{W^{[1]},\; (4 \times 3)} \begin{bmatrix} x_1 \\ x_2 \\ x_3 \end{bmatrix} + \overbrace{ \begin{bmatrix} b^{[1]}_1 \\ b^{[1]}_2 \\ b^{[1]}_3 \\ b^{[1]}_4 \end{bmatrix} }^{b^{[1]},\; (4 \times 1)} = \begin{bmatrix} w^{[1]T}_1 x + b^{[1]}_1 \\ w^{[1]T}_2 x + b^{[1]}_2 \\ w^{[1]T}_3 x + b^{[1]}_3 \\ w^{[1]T}_4 x + b^{[1]}_4 \end{bmatrix} = \underbrace{ \begin{bmatrix} z^{[1]}_1 \\ z^{[1]}_2 \\ z^{[1]}_3 \\ z^{[1]}_4 \end{bmatrix} }_{z^{[1]}} \]