1
00:00:00,210 --> 00:00:01,360
Beautiful.

2
00:00:01,380 --> 00:00:07,070
So now that we've got our environment set up we've got our Jupiter notebook running or Jupiter notebook

3
00:00:07,080 --> 00:00:08,010
server running.

4
00:00:08,010 --> 00:00:12,520
We can create a new Jupiter notebook and get started on some code.

5
00:00:12,520 --> 00:00:16,660
So let's load that up I'm going to maximize this window so I'll give it a name here.

6
00:00:16,680 --> 00:00:20,570
We'll go end to end something nice and simple end to end.

7
00:00:20,580 --> 00:00:30,610
Heart disease classification and in good communication style we'll put a mark down heading something

8
00:00:30,610 --> 00:00:31,040
simple.

9
00:00:31,060 --> 00:00:38,230
Predicting heart disease using machine learning then a little one liner.

10
00:00:38,230 --> 00:00:53,290
So this notebook looks into using various Python based machine learning and data science libraries which

11
00:00:53,290 --> 00:01:07,840
are our tools in an attempt to build a machine learning model capable of predicting whether or not someone

12
00:01:07,960 --> 00:01:15,930
has heart disease based on their medical attributes.

13
00:01:18,070 --> 00:01:19,430
So that's probably more than one line.

14
00:01:19,450 --> 00:01:25,030
We could probably concise that a little bit but that's not our focus our focus is writing code and applying

15
00:01:25,030 --> 00:01:27,310
it to the framework here.

16
00:01:27,310 --> 00:01:28,740
So this is what we want to work through.

17
00:01:28,750 --> 00:01:34,900
This is what we're starting to do we're starting to apply the tools that we've learned to our machine

18
00:01:34,900 --> 00:01:42,490
learning framework in the scope of a full blown end to end machine learning project who you can feel

19
00:01:42,490 --> 00:01:43,300
the excitement.

20
00:01:43,810 --> 00:01:45,460
So how do we start off.

21
00:01:45,460 --> 00:01:49,000
Well the first thing is probably good to outline our approach.

22
00:01:49,180 --> 00:01:53,770
We're going to take the following approach.

23
00:01:53,770 --> 00:01:58,510
So the first step is Problem Definition.

24
00:01:58,910 --> 00:02:01,500
We've kind of done that with the opening line.

25
00:02:01,620 --> 00:02:06,960
The problem definition too is data will look at what data we're going to use to work through this problem.

26
00:02:06,960 --> 00:02:10,820
We've kind of already seen it in previous videos but again for completeness we'll just have a little

27
00:02:10,820 --> 00:02:16,520
overview look at it here then we'll go evaluation will define quickly what an evaluation metric means

28
00:02:16,520 --> 00:02:18,890
for us like what defines success for this.

29
00:02:18,890 --> 00:02:24,350
If we were to deem this project a success this machine learning proof of concept could we predict heart

30
00:02:24,350 --> 00:02:25,720
disease using machine learning.

31
00:02:25,730 --> 00:02:32,000
What would we need as an evaluation metric as a bare minimum features so what features of the data are

32
00:02:32,000 --> 00:02:38,090
we gonna be most focused on in even which contribute most to the model which is step five modelling.

33
00:02:38,300 --> 00:02:45,650
And finally Sept 6 is experimentation and realistically the whole thing is experimentation.

34
00:02:45,660 --> 00:02:50,570
So this one we might start with and again if you're quite experienced here you might just start diving

35
00:02:50,570 --> 00:02:51,440
in straight to the code.

36
00:02:51,440 --> 00:02:52,700
You might know what to do.

37
00:02:52,850 --> 00:02:57,490
But for us because we're still learning we're still figuring out how to approach different problems.

38
00:02:57,590 --> 00:03:04,250
We set up this framework and then we figure out how we can use our tools at each different step.

39
00:03:04,310 --> 00:03:09,550
So let's go back first and foremost problem definition.

40
00:03:09,630 --> 00:03:13,490
We've kind of already done it here about in a statement that we could tell someone else.

41
00:03:13,490 --> 00:03:18,650
So in our case we're doing binary classification so whether someone has heart disease or not.

42
00:03:18,650 --> 00:03:24,630
So there's only two classes member classification is predicting whether something is one thing or another.

43
00:03:24,680 --> 00:03:30,180
So in a statement we want to put it in a nice little quote.

44
00:03:30,260 --> 00:03:44,300
So given clinical parameters about a patient can we predict whether or not they have heart disease wonderful

45
00:03:44,840 --> 00:03:47,660
and then two is the data that we come up here.

46
00:03:47,660 --> 00:03:51,920
We know that our heart disease data is in a CSP file already.

47
00:03:51,920 --> 00:03:55,020
And if we click on that it's going to light up pretty hard to read here.

48
00:03:55,020 --> 00:03:57,970
So that's we're going to import it soon using a pen as data frame.

49
00:03:58,400 --> 00:04:07,220
But if we go up here and we if we go UCI heart disease dataset This is where we find about and this

50
00:04:07,220 --> 00:04:08,600
is step two by the way data.

51
00:04:08,600 --> 00:04:12,290
This is where we're finding out a little bit more about what data we're actually using.

52
00:04:12,290 --> 00:04:17,990
So this is where you could Carmen download it from this is the original source for the UCI machine learning

53
00:04:17,990 --> 00:04:23,060
repository which has a lot more different data sets in here that you can kind of work on and use for

54
00:04:23,060 --> 00:04:30,230
example problems like what we're working through but to get it in the CSB format it's already been formatted

55
00:04:30,350 --> 00:04:32,050
and that's on Kaggle.

56
00:04:32,150 --> 00:04:36,590
Now you can go to Kaggle as well and get a lot more different data sets over here.

57
00:04:36,590 --> 00:04:41,030
It's got a little menu it's got data sets say you can even search for different things.

58
00:04:41,030 --> 00:04:44,180
But this is where I came to originally at this data set.

59
00:04:44,180 --> 00:04:45,260
You can download it here.

60
00:04:45,320 --> 00:04:49,900
So if you click download it's going to tell us a little bit more information about the data.

61
00:04:50,180 --> 00:04:57,240
Some attribute information such as what the different columns stand for we keep going we look here we

62
00:04:57,240 --> 00:05:02,160
see that the different columns this is where their different values are so this what this is is a data

63
00:05:02,160 --> 00:05:03,190
dictionary.

64
00:05:03,480 --> 00:05:06,490
And we're going to see this in a second or use.

65
00:05:06,510 --> 00:05:07,810
This will come in handy.

66
00:05:07,890 --> 00:05:14,470
What we might do actually is if we can copy this and take it back to our notebook.

67
00:05:14,650 --> 00:05:16,490
So this is a data dictionary.

68
00:05:16,750 --> 00:05:21,370
So in like a here create data is he a little ahead of ourselves.

69
00:05:21,400 --> 00:05:27,970
So if we go there boom that's what we can use to reference what the columns are in the data.

70
00:05:27,970 --> 00:05:33,760
So if we go here data we could probably pull out something from here.

71
00:05:33,760 --> 00:05:39,640
So if we copy this this database contains 76 entries or actually our dataset only contains 14.

72
00:05:39,670 --> 00:05:44,380
But then we read here but all published experiments refer to using a subset of 14 of them.

73
00:05:44,580 --> 00:05:45,080
Okay.

74
00:05:45,130 --> 00:05:46,210
Wonderful.

75
00:05:46,210 --> 00:05:51,420
And so then if we went back to the UCI heart disease dataset

76
00:05:54,270 --> 00:05:57,310
we get a little bit of information here.

77
00:05:57,360 --> 00:05:59,850
So only 14 attributes used.

78
00:05:59,850 --> 00:06:04,010
Now you won't always do this for every project that you work on especially if you're working within

79
00:06:04,010 --> 00:06:09,170
a company or within a team the dataset might be given to you by a customer or by a client.

80
00:06:09,180 --> 00:06:14,310
But for the problems that we're working on because we need access to open source data that means data

81
00:06:14,340 --> 00:06:16,130
that everyone has access to.

82
00:06:16,320 --> 00:06:22,770
We can find them publicly on the Internet but then again the process is very similar no matter what

83
00:06:22,770 --> 00:06:24,270
data set that you're working on.

84
00:06:24,270 --> 00:06:29,570
It's all about getting it in the right format that you can work with it in your job in a notebook.

85
00:06:29,640 --> 00:06:42,420
We might put in here the original data came from the Cleveland database from UCI Shane learning repository

86
00:06:45,050 --> 00:06:51,010
there is also a version of it available on Kaggle.

87
00:06:51,630 --> 00:06:55,530
And so what you might do is copy that in there.

88
00:06:55,940 --> 00:06:57,500
Beautiful.

89
00:06:57,500 --> 00:07:01,180
And we'll also copy that in there and we could typing this up later.

90
00:07:01,370 --> 00:07:06,290
This is just some information about the data where did it come from what data do we have.

91
00:07:06,490 --> 00:07:07,270
And so we go here.

92
00:07:07,270 --> 00:07:11,700
Number three evaluation so we were actually working on this project we wanted to implement this.

93
00:07:11,710 --> 00:07:16,240
Let's say we were a hospital who wanted to be able to implement this as a machine learning model as

94
00:07:16,240 --> 00:07:21,730
an application on the front desk if someone comes into us and we're nurse we're measuring these different

95
00:07:21,730 --> 00:07:22,750
parameters about them.

96
00:07:22,750 --> 00:07:28,990
So we found out different patient attributes what metric would we need to judge our model has been effective

97
00:07:28,990 --> 00:07:31,740
has been out of use in play.

98
00:07:32,050 --> 00:07:37,180
So if we're trying to classify whether someone has heart disease or not because that's pretty significant

99
00:07:37,810 --> 00:07:40,640
we'd want a very very accurate model.

100
00:07:40,750 --> 00:07:46,440
And so for example I'm going to make a number up so you might say something like if you can reach 95

101
00:07:46,550 --> 00:07:52,270
per cent accuracy at predicting whether or not a patient has heart disease during this proof of concept

102
00:07:52,270 --> 00:07:58,240
phase which is kind of what we're working through here then you might pursue and try to really get into

103
00:07:58,300 --> 00:07:59,970
the hands of other people.

104
00:08:00,010 --> 00:08:04,390
So that's that's the essence of what we're going to work through here is we're building a machine learning

105
00:08:04,390 --> 00:08:05,570
proof of concept.

106
00:08:05,740 --> 00:08:11,410
The reason why I say proof of concept is because oftentimes machine learning projects will start out

107
00:08:11,740 --> 00:08:17,080
as trying to figure out if there are even enough patterns in the data to be learned by a machine learning

108
00:08:17,080 --> 00:08:17,620
model.

109
00:08:17,740 --> 00:08:24,310
And if there are then you might pursue the project further and get it into production or into some sort

110
00:08:24,310 --> 00:08:25,590
of application.

111
00:08:25,600 --> 00:08:31,570
So again this is just another benchmark we might set ourselves as a goal to work towards at the very

112
00:08:31,570 --> 00:08:32,940
beginning of a project.

113
00:08:33,010 --> 00:08:37,390
And it's not set in stone this may change is just something you might reflect with with your team like

114
00:08:37,390 --> 00:08:42,430
hey if we're going to spend two weeks working on this machine learning project what figure would we

115
00:08:42,430 --> 00:08:47,080
have to end up with for it to be pursued more so let's do that.

116
00:08:47,080 --> 00:09:01,060
So if we can reach 95 percent accuracy at predicting whether or not a patient has heart disease during

117
00:09:01,060 --> 00:09:09,580
the proof of concept or pursue the project and this may be another thing right someone might come to

118
00:09:09,580 --> 00:09:14,500
you at a data science company or something like that song from another team might go hey we've got this

119
00:09:14,500 --> 00:09:20,530
data set we want to measure how many of our customers are churning and we want to see if we can build

120
00:09:20,530 --> 00:09:25,300
a machine learning model to help us out and then they may say hey do you want to work on a proof of

121
00:09:25,300 --> 00:09:30,190
concept like similar to what we're doing here and this is how you might set alarm you might start out

122
00:09:30,580 --> 00:09:32,050
by going problem definition.

123
00:09:32,050 --> 00:09:34,680
Figure out if a customer is going to churn or not.

124
00:09:34,690 --> 00:09:39,760
Where does the data come from it comes from our customer database what's our valuation metric.

125
00:09:39,760 --> 00:09:44,950
Well if we can figure out if a customer is going to churn and about 80 percent accuracy then we might

126
00:09:44,950 --> 00:09:48,760
keep pursuing this and actually get it into our production pipeline.

127
00:09:48,790 --> 00:09:51,660
That's an example kind of workflow the first three steps.

128
00:09:51,940 --> 00:09:54,640
And then finally step forward not final.

129
00:09:54,640 --> 00:09:57,670
We've got a fair bit more to go features.

130
00:09:58,060 --> 00:09:59,330
So if we come back.

131
00:09:59,610 --> 00:10:04,420
So we've done this we've done evaluation want to find success go what features should we model this

132
00:10:04,420 --> 00:10:05,780
is step form.

133
00:10:05,890 --> 00:10:08,860
So this is where we're creating a data dictionary.

134
00:10:09,310 --> 00:10:15,690
And what I mean by that is you may be out to create this on your own by doing a little bit of research.

135
00:10:15,700 --> 00:10:21,790
So my point this involved and again we could tidy this up by putting these all dot points but they'll

136
00:10:21,790 --> 00:10:27,330
start to make sense in a second once we actually see the data we're working with actually year we might

137
00:10:27,330 --> 00:10:30,750
type this into turning this into dot point.

138
00:10:31,230 --> 00:10:33,290
So now we've created our data dictionary.

139
00:10:33,450 --> 00:10:38,640
This is something that you may find through your own research like we've done here finding out about

140
00:10:38,640 --> 00:10:44,850
the data here finding out about the data or you may create it with the help of a subject matter expert

141
00:10:45,460 --> 00:10:50,850
and what I mean by that is say for example you had that team come to you with a whole bunch of customer

142
00:10:50,850 --> 00:10:56,250
data on who's going to churn or not churn meaning and they're going to leave or stop using your product

143
00:10:57,120 --> 00:11:00,530
and they may tell you what different features of the data mean.

144
00:11:00,600 --> 00:11:12,990
And so put here this is where you'll get different information about each of the features in your data.

145
00:11:12,990 --> 00:11:17,670
So essentially when you start to work with the data you won't be a complete novice.

146
00:11:17,700 --> 00:11:22,670
You'll have some idea of what's actually going on or what each.

147
00:11:22,710 --> 00:11:28,890
Each section of the data means and this will make a lot more sense when we look at our data in the flesh

148
00:11:28,920 --> 00:11:36,150
when we import our heart disease CSB file into our Jupiter notebook which is what we're gonna do in

149
00:11:36,150 --> 00:11:36,840
the next video.

150
00:11:37,170 --> 00:11:43,040
So these first four steps 1 2 3 4 problem definition data.

151
00:11:43,040 --> 00:11:44,050
What data do we have.

152
00:11:44,050 --> 00:11:47,450
Evaluation of features don't necessarily have to take that long.

153
00:11:47,570 --> 00:11:53,240
So we've just gone through all four of them in about 10 minutes because what we want to do is get hands

154
00:11:53,240 --> 00:11:59,900
on with the code and let the code and data speak for itself rather than trying to just think about it

155
00:11:59,900 --> 00:12:02,160
here we want to see it in action.

156
00:12:02,270 --> 00:12:04,970
So that's what we're going to do in the next few videos.
