1 00:00:00,000 --> 00:00:02,000 OPERATOR: The following content is provided under a 2 00:00:02,000 --> 00:00:03,840 Creative Commons license. 3 00:00:03,840 --> 00:00:06,850 You're support will help MIT OpenCourseWare continue to 4 00:00:06,850 --> 00:00:10,530 offer high quality educational resources for free. 5 00:00:10,530 --> 00:00:13,390 To make a donation or view additional materials from 6 00:00:13,390 --> 00:00:17,490 hundreds of MIT courses, visit MIT OpenCourseWare course at 7 00:00:17,490 --> 00:00:19,920 ocw.mit.edu. 8 00:00:19,920 --> 00:00:21,710 PROFESSOR: All right. 9 00:00:21,710 --> 00:00:25,390 Today's lecture, mostly I want to talk about what computer 10 00:00:25,390 --> 00:00:27,160 scientists do. 11 00:00:27,160 --> 00:00:30,200 We've sort of been teaching you computer science in the 12 00:00:30,200 --> 00:00:34,060 small, I want to pull back and think in the large about, what 13 00:00:34,060 --> 00:00:36,960 do people do once they learn about computer science? 14 00:00:36,960 --> 00:00:40,320 And then I'll wrap up with a quick overview of what I think 15 00:00:40,320 --> 00:00:42,920 we've accomplished this term. 16 00:00:42,920 --> 00:00:45,350 So what does a computer scientist do? 17 00:00:45,350 --> 00:00:48,700 What they really do is, almost everything. 18 00:00:48,700 --> 00:00:51,500 Graduates of our department, other departments, have done 19 00:00:51,500 --> 00:00:55,310 things like animation for movies you've all seen, they 20 00:00:55,310 --> 00:00:59,050 keep airplanes from falling out of the sky, they help 21 00:00:59,050 --> 00:01:01,620 surgeons do a better job of brain surgery, that's 22 00:01:01,620 --> 00:01:04,410 something Professor Grimson has worked on. 23 00:01:04,410 --> 00:01:10,270 All sorts of exciting things. 24 00:01:10,270 --> 00:01:13,720 Mostly what they have in common, and it's incredibly 25 00:01:13,720 --> 00:01:17,220 varied, what you can do with computer science, but it all 26 00:01:17,220 --> 00:01:20,260 involves thinking computationally. 27 00:01:20,260 --> 00:01:25,070 And if I had to use a single phrase to describe 6.00, 28 00:01:25,070 --> 00:01:27,080 that's the phrase I would use. 29 00:01:27,080 --> 00:01:31,610 The semester is really about computational thinking. 30 00:01:31,610 --> 00:01:34,390 I think this will be a fundamental skill used by 31 00:01:34,390 --> 00:01:39,850 everyone in the world by the middle of the current century. 32 00:01:39,850 --> 00:01:43,790 And it'll be like the, it will become one of the three r's, 33 00:01:43,790 --> 00:01:47,020 reading writing arithmetic. 34 00:01:47,020 --> 00:01:49,810 And I haven't quite figured I how to put an r in the front 35 00:01:49,810 --> 00:01:53,780 of it, but sooner or later. 36 00:01:53,780 --> 00:01:54,480 So what is it? 37 00:01:54,480 --> 00:01:57,550 Well, the process is the process that we've sort of 38 00:01:57,550 --> 00:02:01,010 been advocating throughout the semester. 39 00:02:01,010 --> 00:02:04,880 You identify or invent useful abstractions. 40 00:02:04,880 --> 00:02:08,820 Sometimes they're out there, and we can just pluck them. 41 00:02:08,820 --> 00:02:12,580 Sometimes you have to invent them ourselves. 42 00:02:12,580 --> 00:02:15,790 We then formulate a solution to a problem as some sort of a 43 00:02:15,790 --> 00:02:19,280 computational experiment. 44 00:02:19,280 --> 00:02:22,700 Typically using those abstractions. 45 00:02:22,700 --> 00:02:26,980 Then comes the part that many you get bogged down in, but 46 00:02:26,980 --> 00:02:29,440 it'll get easier for you as you go on. 47 00:02:29,440 --> 00:02:33,310 Is to design and construct a sufficiently efficient 48 00:02:33,310 --> 00:02:36,100 implementation of the experiment. 49 00:02:36,100 --> 00:02:39,590 And I want to emphasize the word sufficiently here, in 50 00:02:39,590 --> 00:02:42,330 that it only has to be fast enough to run 51 00:02:42,330 --> 00:02:43,980 it and get an answer. 52 00:02:43,980 --> 00:02:48,130 And it doesn't have to be the fastest possible. 53 00:02:48,130 --> 00:02:52,070 We then need to validate the experimental setup, convince 54 00:02:52,070 --> 00:02:55,390 ourselves that the code is right, and then run the 55 00:02:55,390 --> 00:02:58,680 experiment, and then evaluate the results, and 56 00:02:58,680 --> 00:03:01,960 then repeat as needed. 57 00:03:01,960 --> 00:03:03,120 And that's, of course, the key. 58 00:03:03,120 --> 00:03:07,200 By now you've all learned that these experiments rarely are 59 00:03:07,200 --> 00:03:10,040 done the first time you run them. 60 00:03:10,040 --> 00:03:12,950 But of course, this is true of experiments in biology and 61 00:03:12,950 --> 00:03:16,040 physics and chemistry and everything else. 62 00:03:16,040 --> 00:03:18,430 But this is the basic process. 63 00:03:18,430 --> 00:03:23,940 And I think, it's a view that's not universally held, 64 00:03:23,940 --> 00:03:26,800 but I think is the correct view of what computational 65 00:03:26,800 --> 00:03:29,280 thinking is all about. 66 00:03:29,280 --> 00:03:33,520 It's an experimental discipline. 67 00:03:33,520 --> 00:03:37,830 So the two a's are abstraction, choosing the 68 00:03:37,830 --> 00:03:42,020 right abstraction, and operating in terms of multiple 69 00:03:42,020 --> 00:03:45,390 layers of abstraction simultaneously. 70 00:03:45,390 --> 00:03:47,360 And that's a little bit tricky. 71 00:03:47,360 --> 00:03:50,070 Something that you've worked on this term. 72 00:03:50,070 --> 00:03:56,010 You invent some beautiful, high level of abstraction. 73 00:03:56,010 --> 00:03:58,600 But then you have to think about it, and implement it 74 00:03:58,600 --> 00:04:01,620 using the rather low level abstractions provided by the 75 00:04:01,620 --> 00:04:04,810 programming language. 76 00:04:04,810 --> 00:04:10,130 So we'll do a simulation of, well, the stock market, we've 77 00:04:10,130 --> 00:04:12,310 looked at it just recently. 78 00:04:12,310 --> 00:04:15,730 And you've got this abstraction of a stock, and at 79 00:04:15,730 --> 00:04:18,230 one level, when we're thinking about the market, we think of 80 00:04:18,230 --> 00:04:20,550 a stock abstractly, as something that has a price 81 00:04:20,550 --> 00:04:22,580 that moves up and down. 82 00:04:22,580 --> 00:04:25,370 But then at the same time, we say, well, is the movement 83 00:04:25,370 --> 00:04:29,830 Gaussian, or uniform, and we're operating at a somewhat 84 00:04:29,830 --> 00:04:31,090 different level. 85 00:04:31,090 --> 00:04:34,410 And then at a lower level, we're asking questions like, 86 00:04:34,410 --> 00:04:37,100 well, how should we represent it? is? 87 00:04:37,100 --> 00:04:41,940 It a dictionary, is it a list, that sort of thing. 88 00:04:41,940 --> 00:04:46,000 And we always bounce back and forth and spend a lot of time 89 00:04:46,000 --> 00:04:49,590 thinking about how the layers relate. 90 00:04:49,590 --> 00:04:53,070 Now the other thing that's important, and it really 91 00:04:53,070 --> 00:04:55,940 distinguishes, I think, computing from a lot of other 92 00:04:55,940 --> 00:04:57,360 disciplines. 93 00:04:57,360 --> 00:05:02,300 Is, we don't just write elegant descriptions of 94 00:05:02,300 --> 00:05:06,130 abstractions on paper, the way you say, would do in 95 00:05:06,130 --> 00:05:07,980 mathematics. 96 00:05:07,980 --> 00:05:11,210 But we have to then automate those attractions. 97 00:05:11,210 --> 00:05:14,100 And we always think in terms of, how can we mechanize the 98 00:05:14,100 --> 00:05:15,490 abstractions? 99 00:05:15,490 --> 00:05:19,510 And that's the computational part, in many ways. 100 00:05:19,510 --> 00:05:21,120 How can we do that? 101 00:05:21,120 --> 00:05:25,280 Well, we can do it because we have precise and exacting 102 00:05:25,280 --> 00:05:29,050 notations in which to express these models. 103 00:05:29,050 --> 00:05:32,870 So I'll say a few words about the model of stocks, or a few 104 00:05:32,870 --> 00:05:35,680 words about the model of a drunk wandering around a 105 00:05:35,680 --> 00:05:40,040 field, but I can't get away with just the words. 106 00:05:40,040 --> 00:05:44,190 Eventually I have to convert the words to code. 107 00:05:44,190 --> 00:05:47,220 And that's sort of the acid test of truth. 108 00:05:47,220 --> 00:05:50,620 Have I really understood what the words mean? 109 00:05:50,620 --> 00:05:54,580 Because if I don't, I can't actually convert it to code. 110 00:05:54,580 --> 00:05:57,870 And that's both the cursing and the bless of being a 111 00:05:57,870 --> 00:06:02,750 computer scientist. It's the curse because, you 112 00:06:02,750 --> 00:06:05,210 can't fake it, right? 113 00:06:05,210 --> 00:06:08,600 And that's one of the reasons that many students end up 114 00:06:08,600 --> 00:06:12,620 spending a lot of time in a course like 6.00. 115 00:06:12,620 --> 00:06:17,260 Because they know whether or not their program works. 116 00:06:17,260 --> 00:06:20,280 When you write a proof in math, you can delude we into 117 00:06:20,280 --> 00:06:23,240 thinking it's a solid proof, when it isn't. 118 00:06:23,240 --> 00:06:26,120 When you write an essay, you can delude yourself into 119 00:06:26,120 --> 00:06:28,520 thinking it's brilliant, when it isn't. 120 00:06:28,520 --> 00:06:32,250 But here, you look at what it does, and it either did what 121 00:06:32,250 --> 00:06:34,500 you thought it would do or didn't. 122 00:06:34,500 --> 00:06:37,140 And so that means you sometimes have to work extra 123 00:06:37,140 --> 00:06:41,550 hard, but the blessing is, when it's done, you really 124 00:06:41,550 --> 00:06:43,030 know you've done it. 125 00:06:43,030 --> 00:06:45,790 And you've got something useful. 126 00:06:45,790 --> 00:06:49,580 And that's because there's a machine that will execute your 127 00:06:49,580 --> 00:06:51,450 descriptions. 128 00:06:51,450 --> 00:06:55,030 And that's what makes it fun. 129 00:06:55,030 --> 00:06:58,710 So some examples of computational thinking. 130 00:06:58,710 --> 00:07:00,720 How difficult is this problem? 131 00:07:00,720 --> 00:07:02,720 That's what we talked about when we talked about 132 00:07:02,720 --> 00:07:04,280 complexity. 133 00:07:04,280 --> 00:07:08,110 And we talked about, for many problems, for all problems, 134 00:07:08,110 --> 00:07:11,110 there's an intrinsic difficulty of solving the 135 00:07:11,110 --> 00:07:13,330 problem with the computation. 136 00:07:13,330 --> 00:07:18,060 Independent of how efficient your particular solution is. 137 00:07:18,060 --> 00:07:21,800 And then the question is, how can I best solve it? 138 00:07:21,800 --> 00:07:24,810 Theoretical computer science has given us precise meaning 139 00:07:24,810 --> 00:07:29,020 to these and related questions. 140 00:07:29,020 --> 00:07:32,500 Thinking recursively, another good example. 141 00:07:32,500 --> 00:07:36,250 Where we take a seemingly difficult problem, and 142 00:07:36,250 --> 00:07:41,740 reformulate it into one which we know how to solve. 143 00:07:41,740 --> 00:07:44,470 Very often, it's a smaller instance of 144 00:07:44,470 --> 00:07:46,360 the original problem. 145 00:07:46,360 --> 00:07:49,140 And we say, gosh, this is hard to solve. 146 00:07:49,140 --> 00:07:51,240 But then we think, well suppose the list only had two 147 00:07:51,240 --> 00:07:53,780 elements in it, would I know how to sort it? 148 00:07:53,780 --> 00:07:55,430 Yeah. 149 00:07:55,430 --> 00:07:58,480 Well, then we can build up and say, therefore I can use that 150 00:07:58,480 --> 00:08:02,620 idea to sort a list of any size. 151 00:08:02,620 --> 00:08:05,300 As part of this thinking recursively we learn about 152 00:08:05,300 --> 00:08:11,990 reduction, we learned how to, say, reduce the problem of 153 00:08:11,990 --> 00:08:16,120 deciding what courses to take to an optimization problem in 154 00:08:16,120 --> 00:08:18,170 terms of the knapsack problem. 155 00:08:18,170 --> 00:08:20,350 Once we did that, we could say, oh, we know how to solve 156 00:08:20,350 --> 00:08:23,840 all knapsack problems, dynamic programming has been around a 157 00:08:23,840 --> 00:08:27,550 long time, we'll just do that. 158 00:08:27,550 --> 00:08:30,110 So we do a lot of these reductions, in betting, 159 00:08:30,110 --> 00:08:33,520 transformations, transforming one problem into another, and 160 00:08:33,520 --> 00:08:36,680 simulations. 161 00:08:36,680 --> 00:08:39,430 So some other examples, choosing an appropriate 162 00:08:39,430 --> 00:08:43,780 representation, modeling the relevant abstracts of a 163 00:08:43,780 --> 00:08:46,100 problem to make it practical. 164 00:08:46,100 --> 00:08:48,700 And this is the essence of abstraction that computer 165 00:08:48,700 --> 00:08:53,020 scientists learn, is how to figure out what's relevant and 166 00:08:53,020 --> 00:08:57,200 ignore what is irrelevant, or less relevant. 167 00:08:57,200 --> 00:08:59,760 Focus on the important things. 168 00:08:59,760 --> 00:09:02,250 That's an enormous skill in not only 169 00:09:02,250 --> 00:09:05,140 computing, but in life. 170 00:09:05,140 --> 00:09:09,160 We worry about worst-case scenarios, damage containment, 171 00:09:09,160 --> 00:09:12,560 error correction, all of this we talked about, we talked 172 00:09:12,560 --> 00:09:16,210 about debugging, defensive programming, making sure the 173 00:09:16,210 --> 00:09:19,770 types were right, but again these are very general things 174 00:09:19,770 --> 00:09:21,740 that we think about. 175 00:09:21,740 --> 00:09:25,520 And we think about the fact, sometimes, it's kind of a nice 176 00:09:25,520 --> 00:09:29,690 idea, the fact that there exists really hard problems is 177 00:09:29,690 --> 00:09:32,120 actually a good thing. 178 00:09:32,120 --> 00:09:35,720 Because that's what let's us do things like use encryption 179 00:09:35,720 --> 00:09:39,300 to get privacy of our data, or privacy for our 180 00:09:39,300 --> 00:09:42,710 communications, privacy of our phone calls. 181 00:09:42,710 --> 00:09:44,970 Because we have learned that some problems are 182 00:09:44,970 --> 00:09:48,480 intrinsically difficult to solve, and that's what coding 183 00:09:48,480 --> 00:09:50,070 is all about. 184 00:09:50,070 --> 00:09:52,470 Or encryption is all about. 185 00:09:52,470 --> 00:09:54,920 That's a nice thing. 186 00:09:54,920 --> 00:09:59,370 I now want to talk more specifically about what one 187 00:09:59,370 --> 00:10:02,200 group of computer scientists does. 188 00:10:02,200 --> 00:10:04,820 And that's my research group. 189 00:10:04,820 --> 00:10:09,610 Which consists of mostly graduate students, but every 190 00:10:09,610 --> 00:10:13,170 year I try and incorporate a few undergraduates in it. 191 00:10:13,170 --> 00:10:15,970 We work in the area of medicine, it's also the area 192 00:10:15,970 --> 00:10:19,080 in which Professor Grimson does most of his work. 193 00:10:19,080 --> 00:10:22,610 The goal is pretty simple: we want to help people live 194 00:10:22,610 --> 00:10:25,680 longer and better lives. 195 00:10:25,680 --> 00:10:26,240 Right? 196 00:10:26,240 --> 00:10:31,250 I don't think any of you will think that's a worthless goal. 197 00:10:31,250 --> 00:10:33,810 But, a second goal is, we want to have fun 198 00:10:33,810 --> 00:10:35,520 while we're doing it. 199 00:10:35,520 --> 00:10:39,500 Because life is way too short to do anything that's not fun 200 00:10:39,500 --> 00:10:41,310 for very long. 201 00:10:41,310 --> 00:10:44,450 So we push the frontiers of computer science, electrical 202 00:10:44,450 --> 00:10:46,530 engineering, and medicine. 203 00:10:46,530 --> 00:10:50,020 Working in close collaboration with physicians, and here 204 00:10:50,020 --> 00:10:51,860 you've got logos of some of the hospitals 205 00:10:51,860 --> 00:10:54,870 with which we work. 206 00:10:54,870 --> 00:10:57,750 It is, of course, fairly technical work. 207 00:10:57,750 --> 00:11:00,890 We use machine learning, clustering, data mining, 208 00:11:00,890 --> 00:11:03,980 algorithm design, signal processing. 209 00:11:03,980 --> 00:11:09,080 And everything we do ends up, eventually, getting translated 210 00:11:09,080 --> 00:11:13,040 to code which we then run. 211 00:11:13,040 --> 00:11:14,990 And so we worry a lot about software 212 00:11:14,990 --> 00:11:17,050 systems and the quality. 213 00:11:17,050 --> 00:11:21,440 We do write systems that, for example, inject electrical 214 00:11:21,440 --> 00:11:24,040 signals into people's brains. 215 00:11:24,040 --> 00:11:25,910 And it's kind of important, when you do that, that the 216 00:11:25,910 --> 00:11:28,750 software does what it's intended to do. 217 00:11:28,750 --> 00:11:31,680 At least if you like the people. 218 00:11:31,680 --> 00:11:36,710 So some specific activities, and this is only a sampling. 219 00:11:36,710 --> 00:11:39,460 We work on extracting clinically useful information 220 00:11:39,460 --> 00:11:43,970 from electrical signals in the human body. 221 00:11:43,970 --> 00:11:46,470 Mostly the heart, the brain, and connected anatomy. 222 00:11:46,470 --> 00:11:49,310 For those of you who've never studied anatomy, I've labeled 223 00:11:49,310 --> 00:11:53,440 the heart and the brain in the diagram for you. 224 00:11:53,440 --> 00:11:57,570 The two major projects in this area we've been working on, is 225 00:11:57,570 --> 00:12:02,920 predicting adverse cardiac events and detecting and 226 00:12:02,920 --> 00:12:06,020 responding to epileptic seizures. 227 00:12:06,020 --> 00:12:11,750 And I want to say a few words about each of those. 228 00:12:11,750 --> 00:12:13,820 We'll skip this. 229 00:12:13,820 --> 00:12:19,390 So example one, treating epilepsy. 230 00:12:19,390 --> 00:12:22,635 I suspect most of you are surprised by the fact that one 231 00:12:22,635 --> 00:12:27,390 percent of the world's population has epilepsy. 232 00:12:27,390 --> 00:12:30,170 This is true in almost every part of the world. 233 00:12:30,170 --> 00:12:32,650 It's true in the United States, it's true in 234 00:12:32,650 --> 00:12:35,460 underdeveloped countries in Central Africa. 235 00:12:35,460 --> 00:12:39,720 It seems to be one of the few diseases that's invariant to 236 00:12:39,720 --> 00:12:43,320 economic situations. 237 00:12:43,320 --> 00:12:47,020 One of the reasons that people are surprised by this number 238 00:12:47,020 --> 00:12:49,400 is, most folks who have epilepsy try 239 00:12:49,400 --> 00:12:52,420 to keep it a secret. 240 00:12:52,420 --> 00:12:55,550 There's a long history, getting back to witches, 241 00:12:55,550 --> 00:12:57,780 people with epilepsy were deemed to be witches, were 242 00:12:57,780 --> 00:13:02,590 burned at the stake, things of that nature. 243 00:13:02,590 --> 00:13:06,770 People who have epilepsy are not allowed by the FAA to work 244 00:13:06,770 --> 00:13:10,670 on maintenance of aircraft. 245 00:13:10,670 --> 00:13:15,990 It's a ridiculous restriction, but it's in the law, so I know 246 00:13:15,990 --> 00:13:18,820 someone with epilepsy who's kept it a secret because he 247 00:13:18,820 --> 00:13:21,710 doesn't want to lose his job. 248 00:13:21,710 --> 00:13:23,910 That's a different sermon. 249 00:13:23,910 --> 00:13:28,280 It's characterized by recurrent seizures, generated 250 00:13:28,280 --> 00:13:33,050 by abnormal electrical activity in the brain. 251 00:13:33,050 --> 00:13:37,530 It's really less a disease than a description of 252 00:13:37,530 --> 00:13:41,100 symptoms, because there are lots of independent, different 253 00:13:41,100 --> 00:13:43,000 causes of it. 254 00:13:43,000 --> 00:13:47,430 It can be inherited, that's a significant fraction. 255 00:13:47,430 --> 00:13:51,340 Or it can be acquired, typically by some sort of 256 00:13:51,340 --> 00:13:54,560 insult to the brain. 257 00:13:54,560 --> 00:13:59,380 People who have strokes or serious infections will 258 00:13:59,380 --> 00:14:00,970 develop epilepsy. 259 00:14:00,970 --> 00:14:06,660 Hemorrhages, and increasingly head injuries. 260 00:14:06,660 --> 00:14:09,290 Turns out to be an illness that is of now great 261 00:14:09,290 --> 00:14:12,090 interested the Defense Department because people are 262 00:14:12,090 --> 00:14:16,970 coming back from Iraq with epilepsy. 263 00:14:16,970 --> 00:14:19,670 So those of you who don't have a strong stomach, you might 264 00:14:19,670 --> 00:14:21,040 want to avert your eyes. 265 00:14:21,040 --> 00:14:23,310 Here's one manifestation of it. 266 00:14:23,310 --> 00:14:27,720 On the left is an EEG, and that's, in this case, a 267 00:14:27,720 --> 00:14:31,030 recording of the electrical activity in the surface of 268 00:14:31,030 --> 00:14:32,780 this girl's brain. 269 00:14:32,780 --> 00:14:35,070 You can see she's wearing what looks like a very funny 270 00:14:35,070 --> 00:14:36,630 looking shower cap. 271 00:14:36,630 --> 00:14:38,690 That's where the electrodes are. 272 00:14:38,690 --> 00:14:41,170 And it's recording the electrical activity in the 273 00:14:41,170 --> 00:14:44,090 brain, on the right is obviously a video. 274 00:14:44,090 --> 00:14:46,560 Well, pretty frightening. 275 00:14:46,560 --> 00:14:48,770 Not all seizures are quite that frightening. 276 00:14:48,770 --> 00:14:50,570 In fact, most of them are not. 277 00:14:50,570 --> 00:14:53,720 Sometimes people have what are called absence seizures, where 278 00:14:53,720 --> 00:14:58,600 they just sort of black out for a period of time. 279 00:14:58,600 --> 00:15:00,870 Still not a good thing if you're, say, driving a car 280 00:15:00,870 --> 00:15:03,700 when that happens. 281 00:15:03,700 --> 00:15:08,150 The key issue here, is that the onset of the seizure seems 282 00:15:08,150 --> 00:15:10,380 unpredictable. 283 00:15:10,380 --> 00:15:15,030 And in particular, it seems unpredictable to the person 284 00:15:15,030 --> 00:15:17,810 who has the seizure. 285 00:15:17,810 --> 00:15:19,960 And that's the real risk. 286 00:15:19,960 --> 00:15:22,680 Seizures are typically self-limiting. 287 00:15:22,680 --> 00:15:25,870 They will correct themselves over time. 288 00:15:25,870 --> 00:15:31,180 Eventually this girl will return to, quote, normal. 289 00:15:31,180 --> 00:15:33,520 The seizure itself will probably be over in a minute 290 00:15:33,520 --> 00:15:37,440 or two, and for about an hour she'll be confused, and then 291 00:15:37,440 --> 00:15:39,520 she'll be OK again. 292 00:15:39,520 --> 00:15:42,760 But, because they're unpredictable, even people who 293 00:15:42,760 --> 00:15:50,380 have as few as, say, two a year, it dominates their life. 294 00:15:50,380 --> 00:15:53,140 So, if you're that girl, and even if you're going to have 295 00:15:53,140 --> 00:15:55,350 one of those a year, you're never going to be 296 00:15:55,350 --> 00:15:57,090 allowed on a bicycle. 297 00:15:57,090 --> 00:15:59,640 Because if that happens when you're on a bicycle, it's 298 00:15:59,640 --> 00:16:01,090 really bad. 299 00:16:01,090 --> 00:16:03,710 If you're an adult, and you have one or two year, you 300 00:16:03,710 --> 00:16:04,960 should never drive a car. 301 00:16:04,960 --> 00:16:10,210 Imagine if you've been driving a car when that happened. 302 00:16:10,210 --> 00:16:13,310 Almost everybody with epilepsy eventually 303 00:16:13,310 --> 00:16:15,360 suffers a serious injury. 304 00:16:15,360 --> 00:16:17,730 They have a seizure while they're on a flight of stairs, 305 00:16:17,730 --> 00:16:20,400 and they fall down and fracture their skull. 306 00:16:20,400 --> 00:16:23,590 They get intra-cranial hematomas, they get burns if 307 00:16:23,590 --> 00:16:27,910 they're cooking at the stove, they drown in the bathtub. 308 00:16:27,910 --> 00:16:32,030 And it's the unpredictability that's bad. 309 00:16:32,030 --> 00:16:34,470 Death is high, two to three times out of the general 310 00:16:34,470 --> 00:16:35,790 population. 311 00:16:35,790 --> 00:16:40,790 Typically by accident related to the seizure. 312 00:16:40,790 --> 00:16:44,520 And then there's something called sudden unexplained 313 00:16:44,520 --> 00:16:50,590 death in epilepsy patients, SUDEP, which is estimated to 314 00:16:50,590 --> 00:16:55,270 be one per 100 patients per year. 315 00:16:55,270 --> 00:16:58,530 Just will die, and no one knows why. 316 00:16:58,530 --> 00:17:02,030 Frequently it will be at night, while they're in bed, 317 00:17:02,030 --> 00:17:04,590 and the conjecture is, they have a seizure, and end up 318 00:17:04,590 --> 00:17:08,540 face down in the pillow, smother, that kind of thing. 319 00:17:08,540 --> 00:17:10,780 So you can imagine, if you're a parent, you have a child 320 00:17:10,780 --> 00:17:13,820 with this, you don't sleep much. 321 00:17:13,820 --> 00:17:15,930 Really very sad. 322 00:17:15,930 --> 00:17:19,750 So we want to do something about that. 323 00:17:19,750 --> 00:17:23,780 And our idea is to detect the seizure early. 324 00:17:23,780 --> 00:17:28,060 There are two onset times, electrographic and clinical. 325 00:17:28,060 --> 00:17:31,310 Electrographic is when the brain first starts looking 326 00:17:31,310 --> 00:17:36,280 suspicious, and clinical is when there's a overt physical 327 00:17:36,280 --> 00:17:40,060 symptom, that stiffness you saw in that young girl. 328 00:17:40,060 --> 00:17:44,090 Probably it went by too fast for any of you to notice, but 329 00:17:44,090 --> 00:17:47,180 if you'd looked carefully at the EEG on the left of that 330 00:17:47,180 --> 00:17:53,210 picture, you would have seen it going abnormal before she 331 00:17:53,210 --> 00:17:57,290 had any clinical symptoms. Because the symptoms are 332 00:17:57,290 --> 00:18:00,410 caused by the electrical activity in the brain, by 333 00:18:00,410 --> 00:18:03,670 definition, it proceeds the symptoms, or at least doesn't 334 00:18:03,670 --> 00:18:05,660 follow them. 335 00:18:05,660 --> 00:18:08,080 So our idea was to try and detect the 336 00:18:08,080 --> 00:18:11,140 electrographic onset. 337 00:18:11,140 --> 00:18:14,320 If you could do this, you could provide warning. 338 00:18:14,320 --> 00:18:18,600 So you could tell somebody, sit down before you fall down. 339 00:18:18,600 --> 00:18:19,800 Get out of the bathtub. 340 00:18:19,800 --> 00:18:22,460 Back away from the stove. 341 00:18:22,460 --> 00:18:25,150 Just an oral warning would be tremendously useful. 342 00:18:25,150 --> 00:18:27,370 You could summon help. 343 00:18:27,370 --> 00:18:31,300 You could tell a parent, come quick, your child is having a 344 00:18:31,300 --> 00:18:34,640 seizure right now in bed or elsewhere. 345 00:18:34,640 --> 00:18:39,200 There are fast-acting drugs, Ativan, which if you inhale at 346 00:18:39,200 --> 00:18:43,250 the start of a seizure, can stop it, reduce it. 347 00:18:43,250 --> 00:18:46,930 And our particular interest is neural stimulation. 348 00:18:46,930 --> 00:18:51,660 There is reason to believe, it's yet to be proved, that if 349 00:18:51,660 --> 00:18:54,840 you apply the correct electrical stimulation at the 350 00:18:54,840 --> 00:18:58,890 very beginning of a seizure, you can block it. 351 00:18:58,890 --> 00:19:02,670 Or at least ameliorate it greatly. 352 00:19:02,670 --> 00:19:04,960 So, here's a picture of an EEG. 353 00:19:04,960 --> 00:19:07,710 And I'll just point out, seizures can 354 00:19:07,710 --> 00:19:08,720 be tricky to find. 355 00:19:08,720 --> 00:19:11,050 You might think this is a seizure, but it isn't. 356 00:19:11,050 --> 00:19:13,570 That's blinking your eyes. 357 00:19:13,570 --> 00:19:16,980 Oh well. 358 00:19:16,980 --> 00:19:21,900 Here is the seizure, but in fact, it's begun about here. 359 00:19:21,900 --> 00:19:25,070 Where things don't look particularly ominous. 360 00:19:25,070 --> 00:19:30,080 So it's pretty subtle to detect. 361 00:19:30,080 --> 00:19:35,060 One of the problems is, EEG varies across patients. 362 00:19:35,060 --> 00:19:38,610 And epileptics have abnormal baselines. 363 00:19:38,610 --> 00:19:38,900 Yeah? 364 00:19:38,900 --> 00:19:48,660 STUDENT: [INAUDIBLE] 365 00:19:48,660 --> 00:19:50,020 PROFESSOR: Highly variable in patients, but 366 00:19:50,020 --> 00:19:52,800 that's kind of typical. 367 00:19:52,800 --> 00:19:56,280 But that would be plenty of time to back away from the 368 00:19:56,280 --> 00:19:59,980 stove, or get off a bicycle. 369 00:19:59,980 --> 00:20:03,140 Not so much time to get off the Mass Turnpike, if you're 370 00:20:03,140 --> 00:20:05,920 driving a car. 371 00:20:05,920 --> 00:20:07,700 But it would be great, if you can give 10 372 00:20:07,700 --> 00:20:08,920 or 15 seconds warning. 373 00:20:08,920 --> 00:20:11,670 In fact, if you could give five seconds warning, it would 374 00:20:11,670 --> 00:20:14,280 be tremendously useful. 375 00:20:14,280 --> 00:20:18,290 And for the treatments, it's even different, right? 376 00:20:18,290 --> 00:20:21,770 Yes, you're exactly right, in that particular case. 377 00:20:21,770 --> 00:20:24,590 The problem is, one of the things I've discovered in 378 00:20:24,590 --> 00:20:29,360 medicine, my work, is that almost all healthy people look 379 00:20:29,360 --> 00:20:34,360 alike, and all sick people look different. 380 00:20:34,360 --> 00:20:40,430 So, EEG, if you have epilepsy, your quote, normal EEG, when 381 00:20:40,430 --> 00:20:44,030 you're not having a seizure, looks weird compared to people 382 00:20:44,030 --> 00:20:48,810 who don't have epilepsy. 383 00:20:48,810 --> 00:20:52,150 People have been building seizure detectors for about 40 384 00:20:52,150 --> 00:20:55,740 years now, and they don't work very well. 385 00:20:55,740 --> 00:20:59,790 Every EEG that gets shipped comes with a seizure detector, 386 00:20:59,790 --> 00:21:03,880 and the first thing most hospitals do is, turn it off. 387 00:21:03,880 --> 00:21:07,400 Because it just doesn't work. 388 00:21:07,400 --> 00:21:11,480 The good news is, that even though each epileptics brain 389 00:21:11,480 --> 00:21:15,080 signals look different, once you've learned what an 390 00:21:15,080 --> 00:21:19,710 individual's signal looks like, it's pretty consistent. 391 00:21:19,710 --> 00:21:22,650 Both the interictal, between seizure, and the 392 00:21:22,650 --> 00:21:25,500 start of the seizure. 393 00:21:25,500 --> 00:21:30,380 Well, that tells a computer scientist, let's use machine 394 00:21:30,380 --> 00:21:36,270 learning to figure out what that patient's EEG looks like. 395 00:21:36,270 --> 00:21:41,720 And build a highly specific detector that will work great 396 00:21:41,720 --> 00:21:45,470 for one person, and not at all for anybody else. 397 00:21:45,470 --> 00:21:48,770 And then we'll just install it, and you know, everyone 398 00:21:48,770 --> 00:21:50,470 gets their own. 399 00:21:50,470 --> 00:21:55,400 So instead of one size fits all, it's design a detector to 400 00:21:55,400 --> 00:21:58,380 fit the patient. 401 00:21:58,380 --> 00:22:03,810 We have been working on this now for about six years. 402 00:22:03,810 --> 00:22:09,790 We've done, we've looked at about 80 patients now, more. 403 00:22:09,790 --> 00:22:12,730 And, highly successful. 404 00:22:12,730 --> 00:22:18,180 And I'm not going to weigh you down with all the statistical 405 00:22:18,180 --> 00:22:20,210 tests and everything, but we've done the kind of things 406 00:22:20,210 --> 00:22:21,950 I talked about in class. 407 00:22:21,950 --> 00:22:25,780 Looking at the data, doing the statistics, and suffice it to 408 00:22:25,780 --> 00:22:27,880 say, it works great. 409 00:22:27,880 --> 00:22:31,600 For nine out of 10 patients, roughly. 410 00:22:31,600 --> 00:22:33,250 And for the tenth, we just have to say, 411 00:22:33,250 --> 00:22:35,600 sorry, we can't do it. 412 00:22:35,600 --> 00:22:40,550 But, you know, you can't help everybody all the time. 413 00:22:40,550 --> 00:22:43,210 We're currently, what you see here, is a picture of a neural 414 00:22:43,210 --> 00:22:44,640 stimulator. 415 00:22:44,640 --> 00:22:49,350 The stimulator itself gets implanted under the clavicle, 416 00:22:49,350 --> 00:22:52,340 and then a wire runs up and wraps around the left vagus 417 00:22:52,340 --> 00:22:56,280 nerve, which is the longest nerve in the human body. 418 00:22:56,280 --> 00:22:57,960 It runs all away from the head, down 419 00:22:57,960 --> 00:22:59,780 into the lower intestine. 420 00:22:59,780 --> 00:23:01,770 Latin for wanderer. 421 00:23:01,770 --> 00:23:03,760 Does amazing things, like control whether 422 00:23:03,760 --> 00:23:07,410 you're hungry or not. 423 00:23:07,410 --> 00:23:10,680 Its main, one of its main functions, is it controls the 424 00:23:10,680 --> 00:23:13,640 parasympathetic nervous system for the heart. 425 00:23:13,640 --> 00:23:16,180 And it's the nerve that the brain uses to tell 426 00:23:16,180 --> 00:23:18,700 the heart, slow down. 427 00:23:18,700 --> 00:23:21,830 But, in addition to transmitting down from the 428 00:23:21,830 --> 00:23:24,890 brain, you can transmit up the nerve. 429 00:23:24,890 --> 00:23:28,300 And in fact, the left one, for reasons I don't understand, 430 00:23:28,300 --> 00:23:31,520 translates much better up than the right one does. 431 00:23:31,520 --> 00:23:34,570 Which transmits much better down. 432 00:23:34,570 --> 00:23:36,300 So use the left one. 433 00:23:36,300 --> 00:23:39,240 And the notion is, if at the start of a seizure, we put a 434 00:23:39,240 --> 00:23:42,870 current on that wire, we stimulate the brain and we 435 00:23:42,870 --> 00:23:44,550 stop the seizure. 436 00:23:44,550 --> 00:23:46,340 That's the theory. 437 00:23:46,340 --> 00:23:50,450 It's been shown to stop seizures in rats. 438 00:23:50,450 --> 00:23:54,780 But I don't much care about helping rats. 439 00:23:54,780 --> 00:23:59,180 People purport to have shown it stops seizures in adults, 440 00:23:59,180 --> 00:24:00,420 or in people. 441 00:24:00,420 --> 00:24:04,990 The level of evidence is, honestly, ambiguous. 442 00:24:04,990 --> 00:24:09,050 Because what they've done is, they've implanted it, and they 443 00:24:09,050 --> 00:24:11,160 give the patient a magnet. 444 00:24:11,160 --> 00:24:13,860 And say, when you're having a seizure, swipe the magnet 445 00:24:13,860 --> 00:24:17,860 across, sorry about that, swipe the magnet across the 446 00:24:17,860 --> 00:24:21,310 stimulator, it will turn it on and stop your seizure. 447 00:24:21,310 --> 00:24:23,830 Well, could you imagine that little girl trying to swipe a 448 00:24:23,830 --> 00:24:26,300 magnet across her chest? 449 00:24:26,300 --> 00:24:27,870 Not likely. 450 00:24:27,870 --> 00:24:33,810 So most people don't do it successfully. 451 00:24:33,810 --> 00:24:37,110 Some people report, I thought I was about to have a seizure, 452 00:24:37,110 --> 00:24:40,020 I swiped the magnet and I didn't have it. 453 00:24:40,020 --> 00:24:43,440 Well, how do we know? 454 00:24:43,440 --> 00:24:45,670 Did they really stop it, or did they just imagine they 455 00:24:45,670 --> 00:24:47,100 were going to have one? 456 00:24:47,100 --> 00:24:50,940 So it's pretty ambiguous, but we're now in the process of 457 00:24:50,940 --> 00:24:53,540 doing some real tests at Beth Israel 458 00:24:53,540 --> 00:24:55,500 Deaconness Medical Center. 459 00:24:55,500 --> 00:24:58,270 And we've been admitting patients, and controlling the 460 00:24:58,270 --> 00:25:02,850 stimulator, and so far I'm optimistic. 461 00:25:02,850 --> 00:25:05,000 All right, one more example. 462 00:25:05,000 --> 00:25:06,870 Predicting death. 463 00:25:06,870 --> 00:25:11,300 Well, that's kind of ominous sounding. 464 00:25:11,300 --> 00:25:14,280 About one and a quarter million Americans have an 465 00:25:14,280 --> 00:25:17,160 acute coronary syndrome each year. 466 00:25:17,160 --> 00:25:20,630 That's to say, some sort of a cardiac event. 467 00:25:20,630 --> 00:25:26,010 A heart attack, or an arrhythmia of some sort, 468 00:25:26,010 --> 00:25:29,790 various kinds of things, unstable angina. 469 00:25:29,790 --> 00:25:33,380 And of that one and a quarter million people, 15 percent to 470 00:25:33,380 --> 00:25:37,200 20 percent of them will die of a cardiac-related event within 471 00:25:37,200 --> 00:25:39,970 the next 4 years. 472 00:25:39,970 --> 00:25:41,530 Pretty high. 473 00:25:41,530 --> 00:25:47,980 In fact, about 5% within the next 90 days, there about. 474 00:25:47,980 --> 00:25:50,150 So what do you do? 475 00:25:50,150 --> 00:25:52,180 The key thing, we have treatments. 476 00:25:52,180 --> 00:25:54,850 We actually know how to treat most of these things. 477 00:25:54,850 --> 00:25:57,960 But we don't know who to give the treatments to? 478 00:25:57,960 --> 00:26:00,900 So, for example, who gets an implanted defibrillator? 479 00:26:00,900 --> 00:26:05,370 Who should be treated aggressively with statins? 480 00:26:05,370 --> 00:26:09,040 We think we've found a new way to decide who should get which 481 00:26:09,040 --> 00:26:10,910 of these kinds of treatments. 482 00:26:10,910 --> 00:26:14,130 Something called morphological variability, which I'll talk 483 00:26:14,130 --> 00:26:16,410 about only briefly. 484 00:26:16,410 --> 00:26:19,510 We've tested it on a fairly large database. 485 00:26:19,510 --> 00:26:23,530 We have a database with about 8,000 patients. 486 00:26:23,530 --> 00:26:26,760 We've looked at 2 days for each patient, each day has 24 487 00:26:26,760 --> 00:26:30,460 hours, each hour has 60 minutes, each minute has, on 488 00:26:30,460 --> 00:26:32,640 average, 70 heartbeats. 489 00:26:32,640 --> 00:26:35,970 That's a lot of heartbeats. 490 00:26:35,970 --> 00:26:38,080 Over a billion. 491 00:26:38,080 --> 00:26:40,720 So a lot of the techniques we've talked about this term, 492 00:26:40,720 --> 00:26:45,530 about how do you deal with big things, I live with every day. 493 00:26:45,530 --> 00:26:48,550 Actually, more accurately, my students live with every day, 494 00:26:48,550 --> 00:26:51,010 and I commiserate. 495 00:26:51,010 --> 00:26:56,350 But the tests are pretty convincing. 496 00:26:56,350 --> 00:27:01,240 As an example, they're implanted defibrillators, 497 00:27:01,240 --> 00:27:04,300 they, too, go under the clavicle. 498 00:27:04,300 --> 00:27:07,270 Fortunately we have two clavicles. 499 00:27:07,270 --> 00:27:10,870 And then they connect to the heart, and they notice, they 500 00:27:10,870 --> 00:27:14,440 have a sensor, they notice the heart is beating very badly, 501 00:27:14,440 --> 00:27:16,060 and they shock the heart. 502 00:27:16,060 --> 00:27:17,950 So you've all seen medical shows, where people put 503 00:27:17,950 --> 00:27:21,700 paddles on, say, clear, the patient goes boom boom, and 504 00:27:21,700 --> 00:27:24,410 then they say, sinus rhythm restored. 505 00:27:24,410 --> 00:27:26,310 Well, this does the same thing, but you 506 00:27:26,310 --> 00:27:28,020 walk around with it. 507 00:27:28,020 --> 00:27:30,700 Now, you don't want to turn on all the time, because as you 508 00:27:30,700 --> 00:27:35,930 can see, it delivers quite a jolt. 509 00:27:35,930 --> 00:27:38,490 Interestingly, this is an article from this fall, from 510 00:27:38,490 --> 00:27:42,970 the New York Times, 90 percent of the people who get one 511 00:27:42,970 --> 00:27:47,260 implanted, and the device itself costs about $50,000, 512 00:27:47,260 --> 00:27:50,100 let alone the cost of implanting it. 513 00:27:50,100 --> 00:27:55,100 90 percent receive negative medical benefit. 514 00:27:55,100 --> 00:27:58,890 How do I know that they received medical benefit? 515 00:27:58,890 --> 00:28:04,190 Well, I know that 90% of them are never turned on. 516 00:28:04,190 --> 00:28:06,100 Remember, there's a sensor that decides whether 517 00:28:06,100 --> 00:28:07,790 to apply the shock. 518 00:28:07,790 --> 00:28:12,270 90 percent of them, the sensor never says, turn on. 519 00:28:12,270 --> 00:28:15,260 So 90 percent of them can deliver no benefit because 520 00:28:15,260 --> 00:28:17,120 they're never used. 521 00:28:17,120 --> 00:28:20,410 On the other hand, clearly having the surgery to implant 522 00:28:20,410 --> 00:28:23,130 this, is some risk. 523 00:28:23,130 --> 00:28:25,290 So that's why the benefit is not only 524 00:28:25,290 --> 00:28:26,400 neutral, but negative. 525 00:28:26,400 --> 00:28:29,970 You've had fairly serious surgery, you've risked 526 00:28:29,970 --> 00:28:34,960 infection, and, in fact, this year several people died. 527 00:28:34,960 --> 00:28:36,900 I think three or four died when leads broke 528 00:28:36,900 --> 00:28:39,190 off on these things. 529 00:28:39,190 --> 00:28:44,120 So, clearly we're putting in too many of them, if only 10 530 00:28:44,120 --> 00:28:45,730 percent are used. 531 00:28:45,730 --> 00:28:49,700 On the other hand, roughly every one minute and 50 532 00:28:49,700 --> 00:28:51,860 seconds, somebody in this country dies a 533 00:28:51,860 --> 00:28:55,790 sudden cardiac death. 534 00:28:55,790 --> 00:28:59,330 More often once every two minutes. 535 00:28:59,330 --> 00:29:05,680 100 of them during the course of this lecture. 536 00:29:05,680 --> 00:29:09,080 If these people all had defibrillators implanted, many 537 00:29:09,080 --> 00:29:11,120 of them would not die. 538 00:29:11,120 --> 00:29:16,820 So, we have a therapy, we just don't know who to give it to. 539 00:29:16,820 --> 00:29:18,470 So, what does this look like? 540 00:29:18,470 --> 00:29:25,480 Again, this is pretty strong stuff. 541 00:29:25,480 --> 00:29:28,660 That's what sudden cardiac death looks like. 542 00:29:28,660 --> 00:29:34,460 An apparently healthy guy, suddenly he's dead. 543 00:29:34,460 --> 00:29:39,260 It's things like this that remind us why we can do real 544 00:29:39,260 --> 00:29:42,310 useful things with our talents or skills. 545 00:29:42,310 --> 00:29:44,930 So how do you identify high risk cases? 546 00:29:44,930 --> 00:29:47,500 Lots of different ways, I won't go through them, but 547 00:29:47,500 --> 00:29:49,670 we're focusing again on the electrical 548 00:29:49,670 --> 00:29:51,480 signals in the heart. 549 00:29:51,480 --> 00:29:54,670 We're trying to evaluate the shape of the heartbeat and 550 00:29:54,670 --> 00:29:57,020 what's going on. 551 00:29:57,020 --> 00:29:59,670 I won't go through details, the only thing I wanted to 552 00:29:59,670 --> 00:30:04,010 point out is, we use dynamic programming 553 00:30:04,010 --> 00:30:05,630 to actually do this. 554 00:30:05,630 --> 00:30:09,150 So the key idea in our method depends upon dynamic 555 00:30:09,150 --> 00:30:13,760 programming. 556 00:30:13,760 --> 00:30:18,350 We've evaluated it several times. 557 00:30:18,350 --> 00:30:20,540 Here's one evaluation. 558 00:30:20,540 --> 00:30:24,780 We took the 25 percent of the population that we thought was 559 00:30:24,780 --> 00:30:26,680 at the highest risk. 560 00:30:26,680 --> 00:30:30,210 And you'll notice that within, actually the first 30 days, 561 00:30:30,210 --> 00:30:34,140 4.19 percent of those people were dead. 562 00:30:34,140 --> 00:30:36,880 This is a retrospective study, by the way. 563 00:30:36,880 --> 00:30:41,300 The ECG had been recorded, and we knew, we had follow-ups on 564 00:30:41,300 --> 00:30:45,260 them, and of the people we said were not, the other 3/4 565 00:30:45,260 --> 00:30:49,680 of the population, a very small fraction died. 566 00:30:49,680 --> 00:30:54,350 So this is called a Kaplan Meier curve, and it 567 00:30:54,350 --> 00:30:56,260 shows a huge gap. 568 00:30:56,260 --> 00:30:59,320 And in fact, roughly speaking, if we think you were at high 569 00:30:59,320 --> 00:31:02,930 risk, you were 8 1/2 times more likely to die within a 570 00:31:02,930 --> 00:31:06,550 month, within 90 days. 571 00:31:06,550 --> 00:31:09,580 And the good news is, we don't do this just so we can say, 572 00:31:09,580 --> 00:31:11,350 make your will. 573 00:31:11,350 --> 00:31:13,000 Get your affairs in order. 574 00:31:13,000 --> 00:31:15,350 We actually do this so that we can say, all right, this is a 575 00:31:15,350 --> 00:31:19,700 person who should maybe get a defibrillator, maybe should 576 00:31:19,700 --> 00:31:22,190 have their arteries cleaned out. 577 00:31:22,190 --> 00:31:24,900 Maybe should take a blood thinner. 578 00:31:24,900 --> 00:31:28,860 Once we know who's at risk, we can do something about it. 579 00:31:28,860 --> 00:31:33,640 All right, all I want to do is just give you a flavor of the 580 00:31:33,640 --> 00:31:37,790 kinds of things you've been learning, are really useful, 581 00:31:37,790 --> 00:31:42,410 and can be used to really do things that are worth doing. 582 00:31:42,410 --> 00:31:46,220 So wrapping up the term, what have you learned? 583 00:31:46,220 --> 00:31:50,350 Well, you know, I think we'll start with this. 584 00:31:50,350 --> 00:31:54,140 If you think what you could do in September, and what you can 585 00:31:54,140 --> 00:31:57,880 do now, you've really come a long way, right? 586 00:31:57,880 --> 00:32:02,080 So try and go back and do problem set number one, and 587 00:32:02,080 --> 00:32:06,390 see how long it takes you now, and how long it took you then. 588 00:32:06,390 --> 00:32:09,590 You'll discover that you really are at a place you were 589 00:32:09,590 --> 00:32:13,400 not in September. 590 00:32:13,400 --> 00:32:16,150 We covered five major topics. 591 00:32:16,150 --> 00:32:19,600 Learning a language for expressing computations, 592 00:32:19,600 --> 00:32:20,390 that's Python. 593 00:32:20,390 --> 00:32:22,000 I already talked about the 594 00:32:22,000 --> 00:32:25,130 importance of having a notation. 595 00:32:25,130 --> 00:32:27,460 Learning about the process of writing and debugging 596 00:32:27,460 --> 00:32:32,470 programs. But more generally, learning about the process of 597 00:32:32,470 --> 00:32:36,770 moving from some relatively ambiguous problem statement. 598 00:32:36,770 --> 00:32:39,990 As you've all noticed in the current problem set, we left a 599 00:32:39,990 --> 00:32:42,360 lot of things unspecified. 600 00:32:42,360 --> 00:32:44,680 You know, and the email was flying back and forth, and 601 00:32:44,680 --> 00:32:48,680 often the answer was, you figure it out. 602 00:32:48,680 --> 00:32:51,260 Because that's one of the things we want you to learn. 603 00:32:51,260 --> 00:32:54,190 To go from some problem statement to a computational 604 00:32:54,190 --> 00:32:57,480 formulation. 605 00:32:57,480 --> 00:33:01,410 As a tool to that, you learned a basic set of recipes, bunch 606 00:33:01,410 --> 00:33:05,310 of different algorithms. And you learned how to use 607 00:33:05,310 --> 00:33:09,160 simulations to deal with problems that did not have 608 00:33:09,160 --> 00:33:12,780 nice closed form solutions. 609 00:33:12,780 --> 00:33:14,920 Why Python? 610 00:33:14,920 --> 00:33:18,540 Well, believe it or not, it's an easy language to learn, 611 00:33:18,540 --> 00:33:20,700 compared to other languages. 612 00:33:20,700 --> 00:33:23,610 Simple syntax, it's interpretive, which helps with 613 00:33:23,610 --> 00:33:27,230 the debugging, you don't have to worry about managing memory 614 00:33:27,230 --> 00:33:31,760 as you would in a language like C. It's modern. 615 00:33:31,760 --> 00:33:35,640 It supports, in a fairly elegant way, object-oriented 616 00:33:35,640 --> 00:33:39,920 programming and classes, and it's increasingly popular. 617 00:33:39,920 --> 00:33:43,980 It's used increasing in other subjects at MIT and other 618 00:33:43,980 --> 00:33:48,300 universities, increasing in industry, and a large and 619 00:33:48,300 --> 00:33:51,920 ever-growing set of libraries. 620 00:33:51,920 --> 00:33:54,440 We talked about writing, testing, and debugging 621 00:33:54,440 --> 00:33:59,980 programs. And if I had one message I want you to remember 622 00:33:59,980 --> 00:34:04,130 about all of this, it's be slow. 623 00:34:04,130 --> 00:34:10,310 Slow down, take it one step at a time, take your time and be 624 00:34:10,310 --> 00:34:14,140 methodical, systematic, and careful. 625 00:34:14,140 --> 00:34:18,710 Understand the problem first. Then think about the overall 626 00:34:18,710 --> 00:34:23,300 structure of the solution, and the algorithms independently 627 00:34:23,300 --> 00:34:25,710 of how you're going to code it up. 628 00:34:25,710 --> 00:34:27,890 So you might say, well, I'm going to use dynamic 629 00:34:27,890 --> 00:34:29,320 programming. 630 00:34:29,320 --> 00:34:32,720 And that's an independent decision from Python or Java 631 00:34:32,720 --> 00:34:37,760 or C++ , or anything else to implement it. 632 00:34:37,760 --> 00:34:40,830 And in fact, it's pretty easy to translate a well-organized 633 00:34:40,830 --> 00:34:44,070 program from one language to another. 634 00:34:44,070 --> 00:34:48,050 Break it into small parts, and we talked about unit testing 635 00:34:48,050 --> 00:34:49,940 and the importance of that. 636 00:34:49,940 --> 00:34:54,140 Nobody can build anything big in one fell swoop. 637 00:34:54,140 --> 00:34:58,590 So, break it into small parts, identify useful abstractions, 638 00:34:58,590 --> 00:35:04,230 both functional and data, code and unit test each part, and 639 00:35:04,230 --> 00:35:06,190 first worry about functionality. 640 00:35:06,190 --> 00:35:08,110 Are you getting the correct answer? 641 00:35:08,110 --> 00:35:09,870 And then efficiency. 642 00:35:09,870 --> 00:35:13,550 And a piece of that is, learn to use pseudo code to help 643 00:35:13,550 --> 00:35:15,890 yourself out. 644 00:35:15,890 --> 00:35:19,710 As I said earlier, be systematic when debugging. 645 00:35:19,710 --> 00:35:22,090 Think about the scientific method. 646 00:35:22,090 --> 00:35:25,300 It's not just something that we use to torture middle 647 00:35:25,300 --> 00:35:27,800 school students. 648 00:35:27,800 --> 00:35:30,780 And when you write a program and it doesn't work, ask 649 00:35:30,780 --> 00:35:34,730 yourself, why it did what it did? 650 00:35:34,730 --> 00:35:38,010 Focus on understanding why the program is doing what it's 651 00:35:38,010 --> 00:35:41,550 doing, rather than why it's not doing what 652 00:35:41,550 --> 00:35:44,150 you wanted it to? 653 00:35:44,150 --> 00:35:46,330 Because as soon as you know why it's doing what it's 654 00:35:46,330 --> 00:35:48,420 doing, you'll know how to fix it. 655 00:35:48,420 --> 00:35:50,570 But if you skip that step, you'll waste an 656 00:35:50,570 --> 00:35:55,020 awful lot of time. 657 00:35:55,020 --> 00:35:58,320 Going from problem statement to computation. 658 00:35:58,320 --> 00:36:00,360 We said a lot of this, you break the problem into a 659 00:36:00,360 --> 00:36:05,630 series of smaller problems. Ideally, reducing it to a 660 00:36:05,630 --> 00:36:08,720 problem you already have code to solve, or somebody else's 661 00:36:08,720 --> 00:36:12,360 code to solve. 662 00:36:12,360 --> 00:36:16,290 My first instinct when I have to solve a problem is, I type, 663 00:36:16,290 --> 00:36:21,450 I go to Google, and I type, I think about, oh this is really 664 00:36:21,450 --> 00:36:23,880 an x problem, a shortest path problem. 665 00:36:23,880 --> 00:36:27,190 I type Python shortest path, and I see what code 666 00:36:27,190 --> 00:36:30,990 pops up on my screen. 667 00:36:30,990 --> 00:36:33,920 But I can't do that until I've realized, oh, it's really a 668 00:36:33,920 --> 00:36:36,910 shortest path, or it's really a knapsack. 669 00:36:36,910 --> 00:36:40,160 If I type Python select courses, I won't 670 00:36:40,160 --> 00:36:43,910 get anything useful. 671 00:36:43,910 --> 00:36:46,590 Think about what kind of output you'd like to see. 672 00:36:46,590 --> 00:36:49,850 I often start thinking about a program by first asking 673 00:36:49,850 --> 00:36:52,610 myself, what's the output going to look like? 674 00:36:52,610 --> 00:36:55,660 And I'll actually write the output down. 675 00:36:55,660 --> 00:36:57,870 And then I'll see if I can't write a program to generate 676 00:36:57,870 --> 00:37:01,210 that kind of output. 677 00:37:01,210 --> 00:37:04,500 Often you can take a problem formulated as an optimization 678 00:37:04,500 --> 00:37:08,080 problem, a lot of thing reduce to finding the minimum or 679 00:37:08,080 --> 00:37:12,440 maximum values, satisfying some set of constraints. 680 00:37:12,440 --> 00:37:15,570 So when you're given something like, how do I find the 681 00:37:15,570 --> 00:37:20,530 directions from here to Providence, think about it as 682 00:37:20,530 --> 00:37:22,610 an optimization problem. 683 00:37:22,610 --> 00:37:26,700 And also, think about whether you really have to solve it. 684 00:37:26,700 --> 00:37:30,040 It's very often the case that an approximate solution is all 685 00:37:30,040 --> 00:37:31,700 you really need. 686 00:37:31,700 --> 00:37:34,080 And they're a lot faster. 687 00:37:34,080 --> 00:37:38,980 So, we think about approximation formally, in the 688 00:37:38,980 --> 00:37:43,010 sense of, say, Newton Raphson, we looked at, successive 689 00:37:43,010 --> 00:37:44,550 approximation. 690 00:37:44,550 --> 00:37:48,980 But more informally, an approximation can be, solve a 691 00:37:48,980 --> 00:37:50,850 simpler problem. 692 00:37:50,850 --> 00:37:53,330 That you don't really need to solve the problem you thought 693 00:37:53,330 --> 00:37:56,520 needed to solve, if you solve something simpler, it 694 00:37:56,520 --> 00:37:58,960 will do just fine. 695 00:37:58,960 --> 00:38:01,180 So you don't find the best solution, you just find a 696 00:38:01,180 --> 00:38:02,930 pretty good solution. 697 00:38:02,930 --> 00:38:07,560 Or you simplify the assumptions and say, well, I'm 698 00:38:07,560 --> 00:38:10,050 going to find directions, and to make my problem a little 699 00:38:10,050 --> 00:38:16,480 simpler, I'm not going to allow myself to take any roads 700 00:38:16,480 --> 00:38:20,790 except highways to get from city a to city b. 701 00:38:20,790 --> 00:38:23,740 It may not be the shortest, but it's an easier problem to 702 00:38:23,740 --> 00:38:29,120 solve because are so many fewer roads. 703 00:38:29,120 --> 00:38:32,140 We talked about algorithms, we talked about big o notation, 704 00:38:32,140 --> 00:38:35,990 orders of growth, that's very important. 705 00:38:35,990 --> 00:38:39,100 We talked a little bit about amortized analysis, that you 706 00:38:39,100 --> 00:38:41,336 might want to, say, sort something first if you were 707 00:38:41,336 --> 00:38:43,100 going to do a lot of searching. 708 00:38:43,100 --> 00:38:46,440 We looked at a bunch of kinds of algorithms. 709 00:38:46,440 --> 00:38:47,380 I've listed them here. 710 00:38:47,380 --> 00:38:49,900 I'm, by the way, going to send you a list with all this stuff 711 00:38:49,900 --> 00:38:52,750 on it, among other things, so don't feel you need to 712 00:38:52,750 --> 00:38:54,700 transcribe it. 713 00:38:54,700 --> 00:38:57,890 But a lot of, surprisingly large number of algorithms, to 714 00:38:57,890 --> 00:39:00,680 cover in one semester, when you think about it. 715 00:39:00,680 --> 00:39:03,520 Exhaustive enumeration, successive approximation, 716 00:39:03,520 --> 00:39:06,880 greedy, divide and conquer, decision trees, dynamic 717 00:39:06,880 --> 00:39:07,910 programming. 718 00:39:07,910 --> 00:39:09,860 Quite a lot. 719 00:39:09,860 --> 00:39:12,580 Specific algorithms and specific optimization 720 00:39:12,580 --> 00:39:18,890 problems. We spent a lot of time on simulation. 721 00:39:18,890 --> 00:39:22,810 It's important, but maybe not as important as all that time, 722 00:39:22,810 --> 00:39:27,350 relative to the semester, but it gave me an excuse to talk 723 00:39:27,350 --> 00:39:30,120 about some things that I wanted to cover. 724 00:39:30,120 --> 00:39:32,760 So it gave me a framework to talk a little bit about 725 00:39:32,760 --> 00:39:35,380 probability and statistics. 726 00:39:35,380 --> 00:39:38,950 And it's my view, personally, that every MIT student should 727 00:39:38,950 --> 00:39:40,880 be made to take such a course. 728 00:39:40,880 --> 00:39:45,190 Since they're not, I tried to sneak it in here. 729 00:39:45,190 --> 00:39:49,460 But it's all, it's important stuff to know. 730 00:39:49,460 --> 00:39:54,060 It gave me an excuse to build some interesting programs. So, 731 00:39:54,060 --> 00:39:59,130 what I hope you noticed, is as I went through these things, I 732 00:39:59,130 --> 00:40:02,810 actually tried to develop the programs incrementally, to 733 00:40:02,810 --> 00:40:05,590 talk about the abstractions, to talk about how 734 00:40:05,590 --> 00:40:07,260 I would test them. 735 00:40:07,260 --> 00:40:12,980 And so, just as important as the simulation itself, was the 736 00:40:12,980 --> 00:40:16,330 process of building the simulation. 737 00:40:16,330 --> 00:40:19,380 And so I just shows that as a mechanism to go through some 738 00:40:19,380 --> 00:40:25,080 case studies of building some interesting programs. It let 739 00:40:25,080 --> 00:40:27,870 us talk about random choice. 740 00:40:27,870 --> 00:40:30,750 Much of the world is, or at least appears to be, 741 00:40:30,750 --> 00:40:32,430 stochastic. 742 00:40:32,430 --> 00:40:36,810 And therefore, we have to model randomness in programs. 743 00:40:36,810 --> 00:40:40,470 And even we don't have to, it can be used to solve problems 744 00:40:40,470 --> 00:40:42,930 that are not inherently random, like finding 745 00:40:42,930 --> 00:40:46,400 the value of pi. 746 00:40:46,400 --> 00:40:48,550 It let us look at the issue of assessing the 747 00:40:48,550 --> 00:40:50,340 quality of an answer. 748 00:40:50,340 --> 00:40:52,840 We look at things, said, do we believe that that answer is 749 00:40:52,840 --> 00:40:54,860 right or not? 750 00:40:54,860 --> 00:40:58,800 And building models of, at least parts of, the world. 751 00:40:58,800 --> 00:41:01,440 Some pervasive themes that we talked about. 752 00:41:01,440 --> 00:41:05,430 The power of abstraction, systematic problem solving, 753 00:41:05,430 --> 00:41:07,790 these will be useful even if you never again write a 754 00:41:07,790 --> 00:41:10,820 program in your whole life. 755 00:41:10,820 --> 00:41:12,430 What next? 756 00:41:12,430 --> 00:41:16,280 Well, many of you, almost all of you, have worked very hard 757 00:41:16,280 --> 00:41:17,860 this semester. 758 00:41:17,860 --> 00:41:20,020 I hope you feel that you've got a return on your 759 00:41:20,020 --> 00:41:20,620 investment. 760 00:41:20,620 --> 00:41:22,320 Only you know that. 761 00:41:22,320 --> 00:41:25,990 As I said earlier, take a look at the problem sets, and see 762 00:41:25,990 --> 00:41:28,300 whether you think you've learned anything. 763 00:41:28,300 --> 00:41:32,400 I'd like you to remember after you leave this course, that 764 00:41:32,400 --> 00:41:36,610 you've got a skill you can use to solve problems. And when 765 00:41:36,610 --> 00:41:40,310 you sit down, and there's some issue that you don't know, 766 00:41:40,310 --> 00:41:44,190 just knock out a program to get your answer. 767 00:41:44,190 --> 00:41:48,400 I do it all the time, and it's very useful. 768 00:41:48,400 --> 00:41:50,250 If you want to take more courses, there are 769 00:41:50,250 --> 00:41:52,190 others you can take. 770 00:41:52,190 --> 00:41:56,370 6.01, the first course for Course 6 majors, 771 00:41:56,370 --> 00:41:58,780 you will find easy. 772 00:41:58,780 --> 00:42:02,000 Experience says, people who take 6.00 first don't 773 00:42:02,000 --> 00:42:05,470 understand what all the fuss is about 6.01. 774 00:42:05,470 --> 00:42:07,840 You'll also find it fun and interesting. 775 00:42:07,840 --> 00:42:11,810 6.034, the introduction to AI, is now using Python. 776 00:42:11,810 --> 00:42:14,530 You know everything you need to know to take that. 777 00:42:14,530 --> 00:42:18,580 6.005, which is software engineering, you know 778 00:42:18,580 --> 00:42:20,490 everything you need to take that. 779 00:42:20,490 --> 00:42:25,280 And, for many of you, you can take 6.006, which is a really 780 00:42:25,280 --> 00:42:28,310 interesting kind of algorithms course. 781 00:42:28,310 --> 00:42:31,570 More advanced algorithms, particularly those you who 782 00:42:31,570 --> 00:42:34,930 like math would find 6.006 really fun. 783 00:42:34,930 --> 00:42:36,590 So if you want to take more courses, there 784 00:42:36,590 --> 00:42:38,300 are courses to take. 785 00:42:38,300 --> 00:42:41,630 Thank you all, good luck with the rest of the semester.