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