-
Notifications
You must be signed in to change notification settings - Fork 419
Expand file tree
/
Copy pathch09s02.html
More file actions
49 lines (42 loc) · 7.57 KB
/
Copy pathch09s02.html
File metadata and controls
49 lines (42 loc) · 7.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>9.2. 什么是残差</title><link rel="stylesheet" type="text/css" href="docbook.css" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><meta name="keywords" content="php,pear,pecl,phar, python, , " /><link rel="home" href="index.html" title="Netkiller Python 手札" /><link rel="up" href="ai.html" title="第 9 章 AI 相关" /><link rel="prev" href="ai.html" title="第 9 章 AI 相关" /><link rel="next" href="ch09s03.html" title="9.3. 网络模型的选择" /></head><body><a xmlns="" href="//www.netkiller.cn/">Home</a> | <a xmlns="" href="//netkiller.github.io/">简体中文</a> | <a xmlns="" href="http://netkiller.sourceforge.net/">繁体中文</a> | <a xmlns="" href="/journal/index.html">杂文</a>
| <a xmlns="" href="https://github.com/netkiller">Github</a> | <a xmlns="" href="https://zhuanlan.zhihu.com/netkiller">知乎专栏</a> | <a xmlns="" href="https://www.facebook.com/bg7nyt">Facebook</a> | <a xmlns="" href="http://cn.linkedin.com/in/netkiller/">Linkedin</a> | <a xmlns="" href="https://www.youtube.com/user/bg7nyt/videos">Youtube</a> | <a xmlns="" href="//www.netkiller.cn/home/donations.html">打赏(Donations)</a> | <a xmlns="" href="//www.netkiller.cn/home/about.html">About</a><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">9.2. 什么是残差</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ai.html">上一页</a> </td><th width="60%" align="center">第 9 章 AI 相关</th><td width="20%" align="right"> <a accesskey="n" href="ch09s03.html">下一页</a></td></tr></table><hr /></div><table xmlns=""><tr><td><iframe src="//ghbtns.com/github-btn.html?user=netkiller&repo=netkiller.github.io&type=watch&count=true&size=large" height="30" width="170" frameborder="0" scrolling="0" style="width:170px; height: 30px;" allowTransparency="true"></iframe></td><td><iframe src="//ghbtns.com/github-btn.html?user=netkiller&repo=netkiller.github.io&type=fork&count=true&size=large" height="30" width="170" frameborder="0" scrolling="0" style="width:170px; height: 30px;" allowTransparency="true"></iframe></td><td><iframe src="//ghbtns.com/github-btn.html?user=netkiller&type=follow&count=true&size=large" height="30" width="240" frameborder="0" scrolling="0" style="width:240px; height: 30px;" allowTransparency="true"></iframe></td><td></td><td><a href="https://zhuanlan.zhihu.com/netkiller"><img src="/images/logo/zhihu-card-default.svg" height="25" /></a></td><td valign="middle"><a href="https://zhuanlan.zhihu.com/netkiller">知乎专栏</a></td><td></td><td></td><td></td><td></td></tr></table><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id3530"></a>9.2. 什么是残差</h2></div></div></div>
<p>在数学和统计学领域,残差(Residual)是指观测值与预测值(或拟合值)之间的差异。设观测值为,预测值为,那么残差。例如,我们通过一个线性回归模型来预测房屋价格。对于某一套房子,实际价格(观测值)是 200 万元,而模型预测出来的价格(预测值)是 180 万元,那么残差就是万元。</p>
<pre class="screen">
残差在回归分析中的应用
评估模型拟合优度:残差可以帮助我们了解模型对数据的拟合程度。如果残差较小,说明模型能够较好地拟合数据。例如,在简单线性回归中,我们可以绘制残差图(以预测值为横坐标,残差为纵坐标)。如果残差在零点附近随机分布,没有明显的规律(如系统性的上升或下降趋势、聚集在某个区域等),这表明模型拟合得比较好。相反,如果残差呈现出某种规律性,比如残差随着预测值的增加而增大,那就意味着模型可能存在问题,比如遗漏了重要的变量或者模型的形式不适合数据。
检测异常值:残差较大的观测点可能是异常值。继续以房屋价格预测为例,如果大部分房子的残差都在 - 10 万元到 10 万元之间,但是有一套房子的残差达到了 100 万元,这就需要我们进一步检查这个观测点。它可能是因为数据录入错误,或者这套房子有一些特殊的属性(如独特的地理位置、豪华的装修等)没有被模型考虑到。
残差在时间序列分析中的应用
在时间序列分析中,残差用于衡量模型对时间序列数据的预测准确性。例如,我们用一个 ARIMA 模型(自回归移动平均模型)来预测某产品的销售量。残差可以帮助我们判断模型是否能够很好地捕捉时间序列的波动特征。如果残差序列中存在明显的自相关性(即残差的当前值与过去值之间存在关联),这可能意味着模型没有充分利用数据中的信息,需要进一步调整模型的参数或者结构。
残差在机器学习中的应用
在机器学习模型评估中,残差也是一个重要的概念。以神经网络模型为例,训练集和测试集上的残差大小可以反映模型的泛化能力。如果模型在训练集上残差很小,但在测试集上残差很大,这可能是出现了过拟合现象。也就是说,模型过度学习了训练集中的细节,而不能很好地推广到新的数据上。我们可以通过一些技术,如正则化等,来减少过拟合,使得模型在测试集上的残差也能保持在一个合理的范围内。
</pre>
</div><script xmlns="" type="text/javascript" id="clustrmaps" src="//cdn.clustrmaps.com/map_v2.js?u=r5HG&d=9mi5r_kkDC8uxG8HuY3p4-2qgeeVypAK9vMD-2P6BYM"></script><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ai.html">上一页</a> </td><td width="20%" align="center"><a accesskey="u" href="ai.html">上一级</a></td><td width="40%" align="right"> <a accesskey="n" href="ch09s03.html">下一页</a></td></tr><tr><td width="40%" align="left" valign="top">第 9 章 AI 相关 </td><td width="20%" align="center"><a accesskey="h" href="index.html">起始页</a></td><td width="40%" align="right" valign="top"> 9.3. 网络模型的选择</td></tr></table></div><script xmlns="">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-11694057-1', 'auto');
ga('send', 'pageview');
</script><script xmlns="" async="async">
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?93967759a51cda79e49bf4e34d0b0f2c";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script><script xmlns="" async="async">
(function(){
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
}
else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
</script></body></html>