-
Notifications
You must be signed in to change notification settings - Fork 25
/
how_modeling_works_2.html
107 lines (88 loc) · 6.19 KB
/
how_modeling_works_2.html
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!DOCTYPE html>
<html>
<script type="text/javascript">var blog_title = "Separating signal from noise";</script>
<script type="text/javascript">var publication_date = "November 10, 2018";</script>
<head>
<link rel="icon" href="images/ml_logo.png">
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<link rel="stylesheet" type="text/css" href="stylesheets/stylesheet.css" media="screen">
<link rel="stylesheet" type="text/css" href="stylesheets/print.css" media="print">
<base target="_blank">
<script type="text/javascript" src="javascripts/blog_head.js"></script>
</head>
<body>
<script type="text/javascript" src="javascripts/blog_header.js"></script>
<!-- MAIN CONTENT -->
<div id="main_content_wrap" class="outer">
<section id="main_content" class="inner">
<p>
For all the content, including video and code,
<a href="https://end-to-end-machine-learning.teachable.com/p/building-blocks-choosing-a-model">
visit the course page for How Modeling Works</a>.
</p>
<h3>Separating signal from noise</h3>
<p>
A model is a story we tell about our data. It is always different from the data itself. It is a simplified version, a cartoon picture, with bold edges and even shading. There are always many stories that can be told by the same data set.
</p>
<p>
When we are building a model, we are making the assumption that our data has two parts, signal and noise. Signal is the real pattern, the repeatable process that we hope to capture and describe. It is the information that we care about. The signal is what lets the model generalize to new situations.
</p>
<p>
The noise is everything else that gets in the way of that. It is imperfections in our sensors, typing things in wrong, variations driven by forces that we can’t or don’t try to model. It is all the other stuff.
</p>
<p>
It’s easy to picture the difference between signal and noise if you imagine listening to your favorite playlist in the middle of winter while there is a heater running nearby. The music is the signal. That’s the thing that you want to track and absorb. The heater fan is noise. It is additional variation piled on top of the signal. And if it gets too loud, it becomes impossible to follow the flow of the signal.
</p>
<h4>The challenge</h4>
<p>
It is the goal of models to describe the signal, despite the noise.
</p>
<p>
A perfect model describes the signal exactly, and ignores all of the noise. If a model fails to capture all of the signal, that type of error is called <strong>bias</strong>. If a model captures of some of the noise, that type of error is called <strong>variance</strong>. Too much bias in our model means that it will perform poorly in all situations because it hasn’t captured the signal well. You may also hear this called <strong>underfitting</strong>.
This was the case when we fit a straight line to our temperature data. It didn’t capture the underlying pattern well, and because of that, had a much higher error then the rest of our candidates.
</p>
<img src="images/how_modeling_works/Linear_model.png" style="width: 600px;" />
<p>
A linear model fit to this data has high bias.
</p>
<p>
Too much variance in our model will also cause it to fail. It won’t generalize well. Instead of capturing just the pattern we care about, it will also capture a lot of extraneous noise that we don’t care about. The patterns in the noise will be different from situation to situation.
When we try to generalize and apply or model to a new situation, it will have extra error. This is also called <strong>overfitting</strong>. The more complex our model, the greater the risk of overfitting. This was the case in the connect-the-dots interpolation model.
</p>
<img src="images/how_modeling_works/Interpolation_model.png" style="width: 600px;" />
<p>
Overfitting is tempting. Don’t fall for it.
</p>
<img src="images/how_modeling_works/xkcd_linear_regression.png" style="width: 400px;" />
<p>
<em>The 95% confidence interval suggests Rexthor's dog could also be a cat, or possibly a teapot.</em>
(<a href="https://xkcd.com/1725/">https://xkcd.com/1725/</a>)
</p>
<h4>The fix</h4>
<p>
The way to protect against underfitting is to try several different types of models. Each model has its own strengths and weaknesses, patterns that it finds more easily and more accurately, and other patterns that it struggles with. By trying a variety of models, we have the best chance at pulling out the patterns hidden in our data. Our best defense against bias is a rich pool of candidate models.
</p>
<p>
To protect against overfitting, we make sure to test how well each trained model generalizes. After training it on one set of observations, we then use it to predict the pattern in another set of observations. If the predictions are accurate, then we know our model is good, and our variance is low. If it makes much worse predictions on the test data set then on the training data set, then we know that the model overfitted the training data, that it captured a lot of noise, rather than just signal.
</p>
<p>
We're really getting warmed up now. Next
<a href="how_modeling_works_3.html">in part 3</a> we'll consider a question that can make or break our model selection: choosing the right error fuction.
</p>
<script type="text/javascript" src="javascripts/blog_signature.js"></script>
</section>
</div>
<script type="text/javascript" src="javascripts/blog_footer.js"></script>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-10180621-3");
pageTracker._trackPageview();
} catch(err) {}
</script>
</body>
</html>