1
00:00:02,350 --> 00:00:08,960
This is what is known in software engineering as test driven development, or TTD in test driven development.

2
00:00:08,980 --> 00:00:13,740
We start by running tests because, number one, your code should always have tests.

3
00:00:14,140 --> 00:00:20,020
And number two, running the test first forces you to think about how you expect your API to work,

4
00:00:20,320 --> 00:00:26,010
and it allows you to make sensible design decisions without being distracted by implementation details.

5
00:00:26,740 --> 00:00:31,360
So you see how this applies to every machine learning algorithm, not just linear regression.

6
00:00:35,580 --> 00:00:40,980
And a lot of my older coding videos, I unfortunately decided to just write the code straight through

7
00:00:41,550 --> 00:00:44,220
this helps some people, but it's not ideal for others.

8
00:00:44,730 --> 00:00:47,880
In addition, the coding videos will appear without warning.

9
00:00:48,610 --> 00:00:51,130
Generally, the lectures appear in the same pattern.

10
00:00:51,610 --> 00:00:54,500
First we do theory and then we do the corresponding code.

11
00:00:54,840 --> 00:00:56,700
It pretty much always works this way.

12
00:00:57,810 --> 00:01:02,970
So after the theory lecture, you can be pretty sure we are going to implement that theory in code soon,

13
00:01:03,210 --> 00:01:09,510
unless it's so simple that it can be an exercise now to avoid treating everyone like they're in kindergarten.

14
00:01:09,750 --> 00:01:12,630
I don't have videos telling you that it's time to code.

15
00:01:13,200 --> 00:01:15,690
You're all proactive and independent adults.

16
00:01:15,900 --> 00:01:21,240
So when you learn some theory, you already know that it's time to try to put that into code by yourself.

17
00:01:25,550 --> 00:01:31,400
Sometimes you might get stuck and have no idea what's a writing code or what the data set is, in that

18
00:01:31,400 --> 00:01:35,690
case, it's fine to watch the next coding lecture, but don't watch it all the way through.

19
00:01:36,290 --> 00:01:41,480
Watch just enough so that you know what the general idea is and what we're trying to accomplish and

20
00:01:41,480 --> 00:01:43,300
then try to finish the rest of yourself.

21
00:01:47,970 --> 00:01:52,710
Now, let's say you've watched just enough so that you know what we're trying to do, you know the theory,

22
00:01:52,740 --> 00:01:58,680
but you still can't complete the code at this point, you may want to revisit the lecture theory to

23
00:01:58,680 --> 00:02:00,480
make sure you really understood each part.

24
00:02:01,230 --> 00:02:05,370
Failing that, you may want to try and get clarification on the discussion board.

25
00:02:05,880 --> 00:02:09,210
Failing that, you may want to look at external resources as well.

26
00:02:09,990 --> 00:02:14,910
Sometimes you might be missing some important computer science background that I've assumed everyone

27
00:02:14,910 --> 00:02:15,720
already knows.

28
00:02:16,290 --> 00:02:19,430
That's perfectly fine because everyone has a different background.

29
00:02:20,070 --> 00:02:22,410
It's highly encouraged to do your own research.

30
00:02:22,410 --> 00:02:24,510
And this is also perfectly normal.

31
00:02:24,900 --> 00:02:26,010
It's not a bad thing.

32
00:02:26,010 --> 00:02:26,820
It's a good thing.

33
00:02:27,420 --> 00:02:32,180
Ask any university student if this is what they do and they'll tell you that they do it all the time.

34
00:02:32,940 --> 00:02:36,150
This builds a level of mental toughness and initiative taking.

35
00:02:36,390 --> 00:02:37,200
That's important.

36
00:02:37,200 --> 00:02:42,450
If you want to learn this stuff, there is a lot to learn and I myself am still learning new things

37
00:02:42,450 --> 00:02:42,960
every day.

38
00:02:46,330 --> 00:02:51,430
So let's say you've watched the theory lecture, you've looked at some external resources on the theory,

39
00:02:51,640 --> 00:02:54,380
and you still don't understand how you would put it into code.

40
00:02:55,240 --> 00:02:58,080
Well, at this point, there are some great exercises you can do.

41
00:02:58,840 --> 00:03:04,270
Watch the coding lecture or look at the focus on GitHub, go through it and make sure you understand

42
00:03:04,270 --> 00:03:04,870
each line.

43
00:03:05,860 --> 00:03:10,270
The next step is without looking at the code again, try to implement it yourself.

44
00:03:10,870 --> 00:03:12,860
This by itself is a great learning tool.

45
00:03:13,510 --> 00:03:18,700
Many of the algorithms I've learned, I didn't understand them the first time I learned them by looking

46
00:03:18,700 --> 00:03:21,370
at someone else's implementation and dissecting it.

47
00:03:23,240 --> 00:03:28,250
I looked at each part and I asked myself, which parts did I get right and which parts did I get wrong?

48
00:03:29,150 --> 00:03:32,180
This helps you understand the mistakes you were making previously.

49
00:03:35,820 --> 00:03:41,970
The cool thing about implementation is it works backwards to we go from theory to code, but thinking

50
00:03:41,970 --> 00:03:45,940
in the reverse direction, the code actually helps us understand the theory better.

51
00:03:45,960 --> 00:03:51,350
Also, I always say that if you can't implement the code, then you don't understand the theory.

52
00:03:52,140 --> 00:03:57,930
So if you can learn the theory 50 percent of the way, try to implement the code, look at an existing

53
00:03:57,930 --> 00:04:00,230
implementation and then finally get it working.

54
00:04:00,480 --> 00:04:04,860
Then you can be guaranteed that you now know more than just 50 percent of the theory.

55
00:04:05,460 --> 00:04:10,350
The active coding helps you understand more of the theory than if you had just learned the theory by

56
00:04:10,350 --> 00:04:10,890
itself.

57
00:04:14,100 --> 00:04:19,470
So implementation helps you understand the theory, but it also helps you understand the intuition as

58
00:04:19,470 --> 00:04:19,820
well.

59
00:04:20,600 --> 00:04:22,290
Intuition is a tricky thing.

60
00:04:22,320 --> 00:04:25,140
In fact, I would go so far as to say it's a trap.

61
00:04:25,710 --> 00:04:30,000
In many or maybe even most cases, intuition is built on experience.

62
00:04:30,540 --> 00:04:35,910
That means driving the theory from first principles or in other words, driving the theory from facts

63
00:04:35,910 --> 00:04:38,990
you already know to be true and from implementation.

64
00:04:39,870 --> 00:04:45,210
Students often want to hear intuition from people with lots of experience, but the problem is that

65
00:04:45,210 --> 00:04:47,340
this intuition is built on hindsight.

66
00:04:51,170 --> 00:04:57,350
Intuition is often both the first thing and the last thing you want to focus on, you want to have a

67
00:04:57,350 --> 00:05:02,910
little bit of intuition at the beginning so you have some general idea of what you want to accomplish.

68
00:05:03,590 --> 00:05:08,960
Then after you learn the theory and implementation, you can reflect on the details and summarize them

69
00:05:08,960 --> 00:05:09,690
at a high level.

70
00:05:10,280 --> 00:05:13,580
This is real intuition built on hindsight and experience.

71
00:05:18,350 --> 00:05:23,690
The big mistake beginners make is that they read some intuition written by someone else who actually

72
00:05:23,690 --> 00:05:26,120
has experience when they themselves do not.

73
00:05:27,050 --> 00:05:30,140
From an outsider's perspective, it's hard to tell the difference.

74
00:05:30,710 --> 00:05:31,430
Why is that?

75
00:05:32,570 --> 00:05:37,730
Well, if the beginner can regurgitate the same high level ideas as the expert, then it would sound

76
00:05:37,730 --> 00:05:40,280
like they are also an expert when in fact they are not.

77
00:05:41,320 --> 00:05:46,570
There are unfortunately, too many courses out there that do this, they want you to feel good that

78
00:05:46,570 --> 00:05:50,670
you learn something and they want to avoid you having to do anything too difficult.

79
00:05:51,670 --> 00:05:56,550
And because you can repeat the same high level intuitions, it actually sounds like you're an expert.

80
00:05:57,070 --> 00:05:58,750
So this is why I call it a trap.

81
00:06:03,370 --> 00:06:08,710
Knowing intuition not only makes you feel like you know something, it also makes you really confident

82
00:06:08,710 --> 00:06:09,640
about this fact.

83
00:06:10,300 --> 00:06:16,060
And then because your ego wants to maintain this confidence, you'll start making crazy statements like

84
00:06:16,060 --> 00:06:21,160
the theory and implementation are not important because you already understand the intuition.

85
00:06:21,760 --> 00:06:24,130
But as you know, this is completely backwards.

86
00:06:28,150 --> 00:06:34,180
Let's summarize this lecture, since that was a lot of information to take in, remember, this lecture

87
00:06:34,180 --> 00:06:36,870
is all about how and why you should code by yourself.

88
00:06:37,420 --> 00:06:43,270
First, we talked about why this is because it ensures you are thinking about the details and filling

89
00:06:43,270 --> 00:06:46,060
in the blanks using your own pattern recognition skills.

90
00:06:46,660 --> 00:06:51,160
It ensures you don't just assume you know what's going on, but that you actually know what's going

91
00:06:51,160 --> 00:06:51,490
on.

92
00:06:52,210 --> 00:06:57,160
There's a big difference, especially if you're the type of person that likes to assume you know everything.

93
00:06:58,120 --> 00:07:02,350
Next, we talked about how we talked about how all data is the same.

94
00:07:02,350 --> 00:07:06,130
And it doesn't really matter what domain or industry your data is from.

95
00:07:06,370 --> 00:07:08,090
The same algorithms all apply.

96
00:07:08,950 --> 00:07:14,160
Next, we looked at the interfaces to the algorithms, which are also conveniently all the same.

97
00:07:14,770 --> 00:07:20,800
So we have a kind of mix and match type of scenario where we can input any kind of data into any kind

98
00:07:20,800 --> 00:07:21,280
of model.

99
00:07:22,130 --> 00:07:28,010
For example, you can use linear regression with financial data or you can use a neural network on ecological

100
00:07:28,010 --> 00:07:32,450
data, all data is the same and all models have the same interface.

101
00:07:36,310 --> 00:07:42,310
Next, we talked about a strategy for how to actually apply this, you've probably already seen that

102
00:07:42,310 --> 00:07:44,670
we always alternate between theory and code.

103
00:07:45,250 --> 00:07:48,610
First we discuss the theory and then we implement that in code.

104
00:07:49,450 --> 00:07:54,370
Sometimes you might have to go back and revisit the theory or sometimes you might have to look things

105
00:07:54,370 --> 00:07:55,230
up on the Internet.

106
00:07:55,600 --> 00:07:56,830
That's perfectly normal.

107
00:07:57,870 --> 00:08:00,970
This is pretty much the day in the life of a university student.

108
00:08:01,680 --> 00:08:06,310
We're trying to build the same level of mental toughness and initiative taking in this course.

109
00:08:06,960 --> 00:08:11,790
So the strategy is stop after you learn the theory and try to code yourself.

110
00:08:12,710 --> 00:08:17,600
Sometimes you need a little more detail, so you might want to watch a little bit of the coding lectures

111
00:08:17,600 --> 00:08:20,960
to see what's going on and then try to implement the rest of yourself.

112
00:08:21,680 --> 00:08:26,600
If you can't get it by yourself, then maybe try watching the whole thing or looking at the expected

113
00:08:26,600 --> 00:08:29,340
result and then trying to implement it from memory.

114
00:08:30,140 --> 00:08:34,850
This by itself is a great learning tool because it allows you to ask yourself, what did I get right

115
00:08:34,850 --> 00:08:36,020
and what did I get wrong?

116
00:08:36,290 --> 00:08:38,450
So you can understand the mistakes you were making.

117
00:08:42,850 --> 00:08:48,550
Finally, it's important to understand the difference between intuition, theory and implementation

118
00:08:48,670 --> 00:08:50,300
and how they reinforce each other.

119
00:08:51,040 --> 00:08:56,770
It's important to not fall into the trap of only understanding intuition written by someone else, and

120
00:08:56,770 --> 00:09:02,740
then assuming that this equates to actually understanding everything in many cases, it's not about

121
00:09:02,740 --> 00:09:06,640
waiting for someone to tell you some nice phrases that trick you into thinking.

122
00:09:06,640 --> 00:09:12,310
You understand the intuition, but rather you should seek intuition by working through the theory and

123
00:09:12,310 --> 00:09:13,330
the implementation.

124
00:09:13,900 --> 00:09:18,040
And lastly, don't forget, when it's time to code, you must code.
