0 1 00:00:00,330 --> 00:00:05,130 Over the next couple of lessons we're going to talk about Python programming in depth. 1 2 00:00:05,130 --> 00:00:09,960 The aim of this section is to make sense and explain the code that we wrote in the previous lessons 2 3 00:00:10,160 --> 00:00:13,040 when we were estimating the movie revenue. 3 4 00:00:13,320 --> 00:00:19,680 As such, the next lessons are not going to teach you more machine learning concepts. 4 5 00:00:19,680 --> 00:00:25,530 Instead, the lessons will focus on the Python programming fundamentals. 5 6 00:00:25,530 --> 00:00:31,380 We're going to take a deep dive into the Python code that we wrote for visualizing our data and for 6 7 00:00:31,380 --> 00:00:34,410 running our regression in the Jupyter notebook. 7 8 00:00:34,410 --> 00:00:37,980 What Python programming fundamentals will we look at? 8 9 00:00:37,980 --> 00:00:45,930 We're going to discuss programming concepts such as variables, data types, functions, methods and objects. 9 10 00:00:46,130 --> 00:00:51,050 These are the fundamental stepping stones on which all the other future lessons are going to be built. 10 11 00:00:52,160 --> 00:00:53,180 For these lessons, 11 12 00:00:53,180 --> 00:00:56,540 I will assume no prior programming knowledge. 12 13 00:00:56,540 --> 00:01:02,000 So if you've already got some programming experience feel free to skip ahead through the upcoming videos 13 14 00:01:02,300 --> 00:01:05,160 or just watch the videos at double speed. 14 15 00:01:05,210 --> 00:01:10,560 Now I also tried really really hard to find you guys some interesting data sets for us to look at. And, 15 16 00:01:10,610 --> 00:01:16,610 I came across a pretty weird medical study that was done in the United States in 1968. 16 17 00:01:16,760 --> 00:01:23,930 So for our programming exercises, we will use the data from this study which examines how math test scores 17 18 00:01:24,140 --> 00:01:28,190 were affected by the use of psychedelic drugs. 18 19 00:01:28,220 --> 00:01:33,400 Now, without further ado, let's jump straight into how to get set up. 19 20 00:01:33,500 --> 00:01:37,130 Let's fire up a new Jupyter notebook. 20 21 00:01:37,130 --> 00:01:42,870 This time we're going to use the locally installed version instead of the try.jupiter.org 21 22 00:01:42,880 --> 00:01:45,470 web site. 22 23 00:01:45,570 --> 00:01:47,770 Now there's different ways you can do this. 23 24 00:01:47,780 --> 00:01:52,400 First let me show you how to do it with the Anaconda Navigator. 24 25 00:01:52,400 --> 00:01:59,930 So simply open the Anaconda Navigator and then click on "Launch" Jupiter notebook. At this point, 25 26 00:01:59,960 --> 00:02:05,900 the Jupyter notebook will open in your browser but you'll notice if you look at your address bar, instead 26 27 00:02:05,900 --> 00:02:08,900 of it reading try.jupiter.org, 27 28 00:02:08,900 --> 00:02:16,140 it will read localhost. The other way to open a Jupyter notebook, without going through the Anaconda 28 29 00:02:16,160 --> 00:02:21,460 Navigator is simply by going through the terminal or the command prompt. 29 30 00:02:21,470 --> 00:02:24,560 First, let me show you how to do this on a mac. On a Mac, 30 31 00:02:24,570 --> 00:02:25,880 you'd open the terminal 31 32 00:02:29,660 --> 00:02:37,610 and then you would type "jupyter notebook" and hit Enter and you'll get exactly the same result as going 32 33 00:02:37,610 --> 00:02:39,260 through the Anaconda Navigator. 33 34 00:02:39,470 --> 00:02:43,310 Since loading the Anaconda Navigator can be a bit slow at times, 34 35 00:02:43,340 --> 00:02:48,810 I actually prefer this as a way of getting to the Jupyter notebook very, very quickly. 35 36 00:02:48,830 --> 00:02:51,750 Now, if you're running a Windows machine, you don't have a terminal. 36 37 00:02:51,770 --> 00:02:55,630 Instead, you'll have something called the command prompt. 37 38 00:02:55,670 --> 00:03:00,740 In fact, when you installed Anaconda, it would have actually given you something called the "Anaconda prompt" 38 39 00:03:00,830 --> 00:03:07,710 as a convenient shortcut. You'll find this Anaconda Prompt in your start menu. 39 40 00:03:07,820 --> 00:03:11,990 So if I go to show all my apps, it's right here - Anaconda prompt. 40 41 00:03:15,740 --> 00:03:20,200 And this is what it looks like. Since I use this Anaconda prompt quite a bit, 41 42 00:03:20,200 --> 00:03:25,450 I've actually pinned it to my taskbar for easy access and this is what I'll recommend for you guys as 42 43 00:03:25,450 --> 00:03:27,580 well. In the Anaconda Prompt, 43 44 00:03:27,610 --> 00:03:29,980 you simply give the same command as on Mac. 44 45 00:03:29,980 --> 00:03:31,210 You're right - "jupyter notebook". 45 46 00:03:34,450 --> 00:03:38,650 When you hit enter, the Jupyter notebook should fire up in your default browser. 46 47 00:03:38,650 --> 00:03:44,020 Now, what we're gonna do is we're going to create a folder where we're gonna save all our work and we're 47 48 00:03:44,020 --> 00:03:52,680 gonna call this folder MLProjects. The way to create this folder is to go to New and then go to New 48 49 00:03:52,680 --> 00:03:54,420 Folder. 49 50 00:03:54,420 --> 00:03:58,130 You should then see an untitled folder appear. 50 51 00:03:58,140 --> 00:04:02,490 But instead of leaving it as "Untitled Folder", you're going to put a tick box next to it and then you're 51 52 00:04:02,490 --> 00:04:04,180 going to hit "Rename". 52 53 00:04:04,320 --> 00:04:12,710 And here you're gonna give it the name MLProjects and confirm, so click on your MLProjects folder 53 54 00:04:12,710 --> 00:04:13,830 to open it. 54 55 00:04:14,060 --> 00:04:18,950 And then once inside you're going to create a new Python notebook. 55 56 00:04:19,040 --> 00:04:21,410 Click on "New", then "Python 3" 56 57 00:04:24,520 --> 00:04:35,130 and then let's rename this notebook to "02 Python intro", hit "Rename" and then let's navigate back 57 58 00:04:35,160 --> 00:04:38,040 to the MLProjects folder. 58 59 00:04:38,190 --> 00:04:43,620 You've probably done some work in the previous lesson when we were working on try.jupyter.org 59 60 00:04:44,100 --> 00:04:51,930 and you've probably downloaded your notebook at the time. What you can do now is upload that notebook 60 61 00:04:52,140 --> 00:04:54,600 to your MLProjects folder. 61 62 00:04:54,720 --> 00:04:57,460 That way you can keep all your coursework together. 62 63 00:04:57,690 --> 00:04:59,110 So just click "Upload". 63 64 00:04:59,310 --> 00:05:05,340 Select your Python notebook and select the cost_revenue_clean data set as well - 64 65 00:05:05,340 --> 00:05:10,440 that CSV file that I provided previously and then click "Open". 65 66 00:05:10,830 --> 00:05:16,290 You should see the two line items appear in your MLProjects folder where you can confirm by hitting 66 67 00:05:16,290 --> 00:05:23,820 the blue "Upload" button. Now you've got your previous work accessible here together with the data set 67 68 00:05:23,880 --> 00:05:26,630 that we used. Great! 68 69 00:05:26,680 --> 00:05:29,350 Now we're all set to dive into Python programming.