Markdown & LaTex 常用语法

blog 的目录

博客园自带目录

[TOC]
出现在随笔页面的开始处,可以帮你显示目录,而无需自己配置javascript,但对比下,和自己配置的略有不同,自定义的有 Back to the topGo to page bottom目录编号

用 javascript 自定义目录

自定义目录:页面定制CSS代码
<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>
自定义目录:页脚Html代码
<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>&nbsp;</p>';
        content += '<hr />';

        // $(mainContent[0]).prepend(go_to_bottom);
        $(mainContent[0]).prepend(content);
        $(mainContent[0]).append(bottom_label);
    }
}

GenerateContentList();
</script>
主标题
===

主标题

副标题
---

副标题

# h1,一级标题

h1,一级标题

## h2,二级标题

h2,二级标题

### h3,三级标题

h3,三级标题

#### h4,四级标题

h4,四级标题

##### h5,五级标题

h5,五级标题

###### h6,六级标题

h6,六级标题

注释

><space><space><enter>
这是一段注释
<space><space><enter>
**a** : 这是一段注释
<space><space><enter>
**b** : 这是一段注释


这是一段注释

a : 这是一段注释

b : 这是一段注释

>这是一段注释
**a** : 这是一段注释
**b** : 这是一段注释

这是一段注释
a : 这是一段注释
b : 这是一段注释

常用的符号及文本形式

$\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

如果你想在markdown中文本缩进

&emsp;&emsp; here
&ensp;&ensp;&ensp;&ensp; here
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; here

   here
     here
         here

无序列表

<ul>
    <li>无序列表1</li>
    <li>无序列表2</li>
    <li>无序列表3</li>
</ul>
  • 无序列表1
  • 无序列表2
  • 无序列表3
* 无序列表1
* 无序列表2
* 无序列表3
  • 无序列表1
  • 无序列表2
  • 无序列表3
+ 无序列表4
+ 无序列表5
+ 无序列表6
  • 无序列表4
  • 无序列表5
  • 无序列表6
- 无序列表7
- 无序列表8
- 无序列表9
  • 无序列表7
  • 无序列表8
  • 无序列表9
* 呆萌小二郎
  * 23岁
  * 前端工程师
  喜欢看书,撸代码,写博客...
* 呆萌小二郎2
  * 嘻嘻哈哈
    * 开心
* 呆萌小二郎3
  • 呆萌小二郎
    • 23岁
    • 前端工程师
      喜欢看书,撸代码,写博客...
  • 呆萌小二郎2
    • 嘻嘻哈哈
      • 开心
  • 呆萌小二郎3

有序列表

<ol>
    <li>有序列表1</li>
    <li>有序列表2</li>
    <li>有序列表3</li>
</ol>
  1. 有序列表1
  2. 有序列表2
  3. 有序列表3
1. 有序列表1
2. 有序列表2
3. 有序列表3
  1. 有序列表1
  2. 有序列表2
  3. 有序列表3
1. 有序列表1
1. 有序列表2
1. 有序列表3
  1. 有序列表1
  2. 有序列表2
  3. 有序列表3

连接跳转

[呆萌小二郎博客跳转链接](http://blog.zhouminghang.xyz)
呆萌小二郎博客跳转链接

度娘一下,你就知道: <http://www.baidu.com>
度娘一下,你就知道: http://www.baidu.com

<http://blog.zhouminghang.xyz>
http://blog.zhouminghang.xyz

插入图像

![xxx](https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1553421507058&di=5171700a9aefd5831ce01b6c0f341436&imgtype=0&src=http%3A%2F%2Fpic175.nipic.com%2Ffile%2F20180711%2F24144945_161350611036_2.jpg)
xxx

斜体,加粗,分割线

*斜体写法1* 和 _斜体写法2_
斜体写法1斜体写法2

**加粗写法1** 和 __加粗写法2__
加粗写法1加粗写法2

* * *


***


*****************


- - -


-----------------


---


单行和多行代码块

`单行代码`
单行代码

```
多行代码(
\这里用来转义符号,
类似于html中单双引号多层嵌套要转义
)
```

多行代码(
        \这里用来转义符号,
        类似于html中单双引号多层嵌套要转义
        )

markdown 的表格 和 LaTeX 中的空格

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|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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
CommandDescription        Size
\,small space3/18 of a quad
\:medium space4/18 of a quad
\;large space5/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\)


转载于:https://www.cnblogs.com/keyshaw/p/10588152.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值