Skip to content

Commit

Permalink
deploy: 519dd02
Browse files Browse the repository at this point in the history
  • Loading branch information
tianxuzhang committed Dec 14, 2023
1 parent 051ca7b commit 5b1cfc9
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 21 deletions.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 15 additions & 6 deletions _sources/docs/降维/LDA和QDA.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,28 @@
"1. 先找到类的中心,来代表一个类的核心特征\n",
"2. 再计算类内样本的差异性,尽可能小\n",
"3. 然后计算类间样本的差异性,尽可能大\n",
"4. 最后,求目标函数让得到投影向量\n",
"4. 最后,求目标函数得到投影向量\n",
"\n",
"那么,换成数学表达就是:\n",
"* 均值向量\n",
"1. 均值向量:对于每个类别 $i$,计算该类别所有样本特征向量的平均值。这个平均值被称为类别内均值向量 $\\mu_i$。\n",
"\n",
"对于每个类别 $i$,计算该类别所有样本特征向量的平均值。这个平均值被称为类别内均值向量 $\\mu_i$。\n",
"公式:$\\mu_i = \\frac{1}{N_i} \\sum_{x \\in i} x$,其中 $x$ 属于类别 $i$,$N_i$ 是类别 $i$ 的样本数量。\n",
" \n",
"\n",
"* 协方差矩阵\n",
"2. 协方差矩阵:对于每个类别 $i$,计算该类别内样本与其类别内均值向量之间的协方差矩阵。协方差矩阵衡量了同一类别内样本之间的差异程度。\n",
"\n",
"公式:$S_i = \\frac{1}{N_i - C} \\sum_{x \\in i}(x - \\mu_i)(x - \\mu_i)^T$,其中 $C$ 是类别数量。\n",
"\n",
"* 散度矩阵\n",
"* 解广义特征值\n",
"\n",
"3. 散度矩阵:计算不同类别之间的差异程度。通过计算每个类别均值向量 $\\mu_i$ 与总体均值向量 $\\mu$ 之间的协方差矩阵,可以得到类间散度矩阵 $S_b$。\n",
"\n",
"公式:$S_b = \\frac{1}{C-1} \\sum_{i=1}^{C} N_i (\\mu_i - \\mu)(\\mu_i - \\mu)^T$,其中 $\\mu$ 是总体均值向量。\n",
"\n",
"4. 解广义特征值:LDA的目标是找到一个投影向量 $w$,使得投影后的数据能够最大化同类样本之间的差异并最小化不同类样本之间的差异。\n",
"这可以通过求解广义特征值问题来实现。\n",
"\n",
"广义特征值问题的目标函数为:$J(w) = \\frac{w^T S_b w}{w^T S_w w}$,\n",
"其中 $S_b$ 是类间散度矩阵,$S_w$ 是类别内散度矩阵。\n",
"\n",
"通过求解这个特征值问题,我们可以得到最佳的投影向量 $w$,用于将高维数据映射到低维空间,并实现优秀的分类效果。"
]
Expand Down
2 changes: 1 addition & 1 deletion docs/回归/稳健回归.html
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ <h2>Theil-Sen<a class="headerlink" href="#theil-sen" title="Permalink to this he
</div>
</div>
<div class="cell_output docutils container">
<img alt="../../_images/280b0983173c7ba7761b8269ee671a9e09a211b665e5057675d259f419bdf5dc.png" src="../../_images/280b0983173c7ba7761b8269ee671a9e09a211b665e5057675d259f419bdf5dc.png" />
<img alt="../../_images/8ca011a18b67f9de8ff4f7160ec24cdb685e6d96f1a385d90acbaf7f6e799037.png" src="../../_images/8ca011a18b67f9de8ff4f7160ec24cdb685e6d96f1a385d90acbaf7f6e799037.png" />
<img alt="../../_images/85744ceca7203143ec6cbb3041b636650691c91aacda636156cf7f46f29dc195.png" src="../../_images/85744ceca7203143ec6cbb3041b636650691c91aacda636156cf7f46f29dc195.png" />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/回归/被动攻击算法.html
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ <h1>被动攻击算法<a class="headerlink" href="#id1" title="Permalink to this
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>预测结果: [11.85000055 13.80000053]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>预测结果: [11.85002666 13.8000254 ]
</pre></div>
</div>
</div>
Expand Down
32 changes: 20 additions & 12 deletions docs/降维/LDA和QDA.html
Original file line number Diff line number Diff line change
Expand Up @@ -405,19 +405,27 @@ <h2>线性判别分析(LDA)<a class="headerlink" href="#lda" title="Permalin
<li><p>先找到类的中心,来代表一个类的核心特征</p></li>
<li><p>再计算类内样本的差异性,尽可能小</p></li>
<li><p>然后计算类间样本的差异性,尽可能大</p></li>
<li><p>最后,求目标函数让得到投影向量</p></li>
<li><p>最后,求目标函数得到投影向量</p></li>
</ol>
<p>那么,换成数学表达就是:</p>
<ul class="simple">
<li><p>均值向量</p></li>
</ul>
<p>对于每个类别 <span class="math notranslate nohighlight">\(i\)</span>,计算该类别所有样本特征向量的平均值。这个平均值被称为类别内均值向量 <span class="math notranslate nohighlight">\(\mu_i\)</span>
公式:<span class="math notranslate nohighlight">\(\mu_i = \frac{1}{N_i} \sum_{x \in i} x\)</span>,其中 <span class="math notranslate nohighlight">\(x\)</span> 属于类别 <span class="math notranslate nohighlight">\(i\)</span><span class="math notranslate nohighlight">\(N_i\)</span> 是类别 <span class="math notranslate nohighlight">\(i\)</span> 的样本数量。</p>
<ul class="simple">
<li><p>协方差矩阵</p></li>
<li><p>散度矩阵</p></li>
<li><p>解广义特征值</p></li>
</ul>
<ol class="arabic simple">
<li><p>均值向量:对于每个类别 <span class="math notranslate nohighlight">\(i\)</span>,计算该类别所有样本特征向量的平均值。这个平均值被称为类别内均值向量 <span class="math notranslate nohighlight">\(\mu_i\)</span></p></li>
</ol>
<p>公式:<span class="math notranslate nohighlight">\(\mu_i = \frac{1}{N_i} \sum_{x \in i} x\)</span>,其中 <span class="math notranslate nohighlight">\(x\)</span> 属于类别 <span class="math notranslate nohighlight">\(i\)</span><span class="math notranslate nohighlight">\(N_i\)</span> 是类别 <span class="math notranslate nohighlight">\(i\)</span> 的样本数量。</p>
<ol class="arabic simple" start="2">
<li><p>协方差矩阵:对于每个类别 <span class="math notranslate nohighlight">\(i\)</span>,计算该类别内样本与其类别内均值向量之间的协方差矩阵。协方差矩阵衡量了同一类别内样本之间的差异程度。</p></li>
</ol>
<p>公式:<span class="math notranslate nohighlight">\(S_i = \frac{1}{N_i - C} \sum_{x \in i}(x - \mu_i)(x - \mu_i)^T\)</span>,其中 <span class="math notranslate nohighlight">\(C\)</span> 是类别数量。</p>
<ol class="arabic simple" start="3">
<li><p>散度矩阵:计算不同类别之间的差异程度。通过计算每个类别均值向量 <span class="math notranslate nohighlight">\(\mu_i\)</span> 与总体均值向量 <span class="math notranslate nohighlight">\(\mu\)</span> 之间的协方差矩阵,可以得到类间散度矩阵 <span class="math notranslate nohighlight">\(S_b\)</span></p></li>
</ol>
<p>公式:<span class="math notranslate nohighlight">\(S_b = \frac{1}{C-1} \sum_{i=1}^{C} N_i (\mu_i - \mu)(\mu_i - \mu)^T\)</span>,其中 <span class="math notranslate nohighlight">\(\mu\)</span> 是总体均值向量。</p>
<ol class="arabic simple" start="4">
<li><p>解广义特征值:LDA的目标是找到一个投影向量 <span class="math notranslate nohighlight">\(w\)</span>,使得投影后的数据能够最大化同类样本之间的差异并最小化不同类样本之间的差异。
这可以通过求解广义特征值问题来实现。</p></li>
</ol>
<p>广义特征值问题的目标函数为:<span class="math notranslate nohighlight">\(J(w) = \frac{w^T S_b w}{w^T S_w w}\)</span>
其中 <span class="math notranslate nohighlight">\(S_b\)</span> 是类间散度矩阵,<span class="math notranslate nohighlight">\(S_w\)</span> 是类别内散度矩阵。</p>
<p>通过求解这个特征值问题,我们可以得到最佳的投影向量 <span class="math notranslate nohighlight">\(w\)</span>,用于将高维数据映射到低维空间,并实现优秀的分类效果。</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
Expand Down Expand Up @@ -590,7 +598,7 @@ <h2>线性判别分析(LDA)<a class="headerlink" href="#lda" title="Permalin
</div>
</div>
<div class="cell_output docutils container">
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/tmp/ipykernel_2265/3074259613.py:16: MatplotlibDeprecationWarning: The register_cmap function was deprecated in Matplotlib 3.7 and will be removed two minor releases later. Use ``matplotlib.colormaps.register(name)`` instead.
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/tmp/ipykernel_2262/3074259613.py:16: MatplotlibDeprecationWarning: The register_cmap function was deprecated in Matplotlib 3.7 and will be removed two minor releases later. Use ``matplotlib.colormaps.register(name)`` instead.
plt.cm.register_cmap(cmap=cmap)
</pre></div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

0 comments on commit 5b1cfc9

Please sign in to comment.