1 00:00:00,133 --> 00:00:05,046 [MUSIC] 2 00:00:05,046 --> 00:00:10,260 So what we're gonna do next 3 00:00:10,260 --> 00:00:15,021 is #Let's show what our 4 00:00:15,021 --> 00:00:19,791 predictions look like. 5 00:00:19,791 --> 00:00:26,817 Now I talked about using GraphLab Canvas as a way to visualize data, but 6 00:00:26,817 --> 00:00:34,350 you can also use other tools out there to visualize; other python tools. 7 00:00:34,350 --> 00:00:39,270 So just as a simple demonstration of that, I'm going to import one search tool. 8 00:00:39,270 --> 00:00:41,620 It's a pretty commonly used one. 9 00:00:41,620 --> 00:00:44,250 It's called mot plot lib. 10 00:00:47,150 --> 00:00:49,900 And so, and from there I'm gonna 11 00:00:49,900 --> 00:00:55,220 input something called pipe plot which allows you to do some plotting in Python. 12 00:00:55,220 --> 00:00:59,060 And I'm gonna refer to it as PLT. 13 00:00:59,060 --> 00:01:05,573 So when you're doing the importing Python, if you type import myplotlib.pyplot, 14 00:01:05,573 --> 00:01:09,920 is a particular piece of the package, and I write as plt. 15 00:01:09,920 --> 00:01:14,000 Now I don't have to write this whole thing matlab_lib.pyplot blah blah blah, 16 00:01:14,000 --> 00:01:15,330 I just write plt. 17 00:01:15,330 --> 00:01:16,660 That's why we use the as command. 18 00:01:17,840 --> 00:01:22,620 So I'm gonna import it, and one little trick I'm gonna do, just like you did with 19 00:01:22,620 --> 00:01:27,010 Canvas to make sure it prints inside the notebook I'm gonna do it here too. 20 00:01:27,010 --> 00:01:31,864 So you put this percent, and 21 00:01:31,864 --> 00:01:37,130 you say, matplotlib inline. 22 00:01:37,130 --> 00:01:40,400 So that just plots it on the notebook itself. 23 00:01:40,400 --> 00:01:41,930 So let's hit Enter. 24 00:01:41,930 --> 00:01:46,130 We've imported it, and now I'm going to actually build 25 00:01:47,190 --> 00:01:54,970 a map plot lib plot for the results, for the initial results. 26 00:01:54,970 --> 00:01:57,970 So we're gonna plot plt.plot. 27 00:01:57,970 --> 00:02:00,680 And there's a function here. 28 00:02:01,690 --> 00:02:06,480 And I'm gonna plot my test data in two ways. 29 00:02:06,480 --> 00:02:11,940 So it's interesting, can plot two multiple plots on top of each other with MyPlot 11. 30 00:02:11,940 --> 00:02:13,480 We're just gonna do that together. 31 00:02:13,480 --> 00:02:18,550 So I'm gonna take my test data and in my test data I'm 32 00:02:18,550 --> 00:02:24,250 gonna plot on the x-axis the square feet of living space. 33 00:02:26,190 --> 00:02:32,690 And in the y-axis for my test data, I'm going to plot the price. 34 00:02:32,690 --> 00:02:36,780 So, this is kind of similar to the plot we did above, the scatter plot. 35 00:02:36,780 --> 00:02:40,910 And I'm gonna refer to each one of these points as test points. 36 00:02:40,910 --> 00:02:43,050 I'm gonna draw them as a dot. 37 00:02:43,050 --> 00:02:44,830 So, that's what this little dot here does. 38 00:02:46,320 --> 00:02:50,570 However, I'm also going to plot one more thing. 39 00:02:50,570 --> 00:02:53,220 So I'm going to plot two things on the same plot. 40 00:02:54,830 --> 00:02:57,790 Actually, so I'm missing a comma up here. 41 00:03:00,060 --> 00:03:03,380 So in addition to plotting the test data, let's plot our predictions. 42 00:03:06,090 --> 00:03:13,710 So again, on the x-axis is going to be the square feet of living space, 43 00:03:13,710 --> 00:03:20,540 but on the y-axis, I'm going to plot something else. 44 00:03:20,540 --> 00:03:25,780 I'm going to plot what my model predicted for each one of those houses. 45 00:03:25,780 --> 00:03:30,400 So remember we built this square foot model and 46 00:03:32,030 --> 00:03:34,540 it has many functions associated with it. 47 00:03:34,540 --> 00:03:38,930 If you go down, one of those functions it has is called the predict function. 48 00:03:38,930 --> 00:03:42,890 And the predict function, you can give it a bunch of data's input and 49 00:03:42,890 --> 00:03:48,590 it's gonna output and estimates our column of data with the predictions for 50 00:03:48,590 --> 00:03:50,730 each one of these input elements. 51 00:03:50,730 --> 00:03:54,370 So, I'm giving you the test data and I'm going to draw it as a dash. 52 00:03:56,530 --> 00:03:59,390 Now, before I execute this line, 53 00:03:59,390 --> 00:04:02,740 just take a moment to imagine what this plot is going to look like. 54 00:04:02,740 --> 00:04:08,020 So, the top line says plot living space through the price test data with dots. 55 00:04:08,020 --> 00:04:11,800 It's going to look very similar to the scatterplot that we drew before. 56 00:04:11,800 --> 00:04:14,590 And the second line says plot 57 00:04:14,590 --> 00:04:19,310 the input houses living with the prediction with a dash. 58 00:04:19,310 --> 00:04:22,670 And now remember this was a simple linear regression model with a single variable so 59 00:04:22,670 --> 00:04:26,580 all we have is a single variable and 60 00:04:26,580 --> 00:04:31,350 as we covered in the lectures, we just plotted a single line. 61 00:04:31,350 --> 00:04:35,630 And we'll see that execute and here we are. 62 00:04:36,670 --> 00:04:41,182 So the blue dots here are the test data for the houses, 63 00:04:41,182 --> 00:04:46,710 while the green line corresponds to the predicted house values. 64 00:04:48,590 --> 00:04:52,729 [MUSIC]