0
1
00:00:00,520 --> 00:00:01,070
Hi, guys.
1

2
00:00:01,090 --> 00:00:03,280
This is Angela from the London App Brewery.
2

3
00:00:03,280 --> 00:00:08,510
And in this module, I have something really exciting that I'm going to talk to you about and that's 
3

4
00:00:08,510 --> 00:00:09,180
CoreML.
4

5
00:00:09,250 --> 00:00:15,190
So this is Apple's new machine learning framework and it's something that's going to enable us as app
5

6
00:00:15,190 --> 00:00:18,370
developers to make our apps more intelligent.
6

7
00:00:18,370 --> 00:00:24,700
Now, ever since it was announced that WWDC in June, we've all been really, really excited, and I've been
7

8
00:00:24,700 --> 00:00:30,010
trying out a number of things using coreML implementing it in a number of applications.
8

9
00:00:30,040 --> 00:00:34,050
So in this module, I want to introduce you to what machine learning is.
9

10
00:00:34,060 --> 00:00:39,580
So if you've never heard of machine learning or you know you just want quick ones over of what are
10

11
00:00:39,580 --> 00:00:40,870
the various aspects of it
11

12
00:00:40,900 --> 00:00:46,890
and some of the theory behind how machine learning works, then this is the place to be.
12

13
00:00:46,900 --> 00:00:51,880
So firstly, we're gonna talk about what machine learning is, and then we're going to move on to the different
13

14
00:00:51,880 --> 00:00:57,400
types of machine learning that are currently available, and some of the real-life applications of machine
14

15
00:00:57,400 --> 00:00:57,840
learning.
15

16
00:00:57,940 --> 00:01:03,610
And then we're going to jump into a practical session where I teach you how to use CoreML to implement
16

17
00:01:03,640 --> 00:01:07,200
visual recognition in your iOS app using Swift 4.
17

18
00:01:07,360 --> 00:01:09,250
So I can't wait to get started,
18

19
00:01:09,250 --> 00:01:10,180
I hope you're the same.
19

20
00:01:10,180 --> 00:01:16,090
So let's begin. I want to start off by addressing what exactly is machine learning.
20

21
00:01:16,210 --> 00:01:22,430
Now, as with everything ending in "ing," machine learning is simultaneously a problem as well as a solution.
21

22
00:01:22,510 --> 00:01:29,520
So, it's basically a field of study that allows computers to learn without being explicitly programmed.
22

23
00:01:29,530 --> 00:01:35,710
So throughout this entire course, we've been teaching you how to program using Swift and how to give
23

24
00:01:35,710 --> 00:01:41,840
the computer, be it the iPhone or the iPad explicit instructions, as to what it should do.
24

25
00:01:41,860 --> 00:01:49,210
So, for example, in the Quizzler app, when the user taps on the right answer, we're saying if user got the answer
25

26
00:01:49,210 --> 00:01:49,780
right,
26

27
00:01:49,780 --> 00:01:53,290
then show them a tick and tell them you were right,
27

28
00:01:53,290 --> 00:01:53,620
right?
28

29
00:01:53,620 --> 00:01:55,200
So that's an "if" statement.
29

30
00:01:55,240 --> 00:01:59,500
What if instead of giving the computer instructions like step one, do this, then do that.
30

31
00:01:59,500 --> 00:02:01,090
If this happens, then do that.
31

32
00:02:01,090 --> 00:02:07,900
What if we just tried to teach it like we would a child and get it to learn through its experience.
32

33
00:02:07,930 --> 00:02:10,210
Well, this is kind of what machine learning is.
33

34
00:02:10,220 --> 00:02:11,830
So let me give you an example.
34

35
00:02:11,860 --> 00:02:13,190
So I've got a BB-8 here.
35

36
00:02:13,240 --> 00:02:16,720
And let's say, we want it to go towards the end point,
36

37
00:02:16,720 --> 00:02:18,510
so that's where the flagpole is.
37

38
00:02:18,580 --> 00:02:24,700
Now, I could program this by saying to the robot or the BB-8, move forward.
38

39
00:02:24,700 --> 00:02:27,300
So this is of, course, pseudocode, but you get the point.
39

40
00:02:27,330 --> 00:02:33,670
So move forwards, right? So it to moves forward. And, oh, look, there's an obstruction and it can't continue moving
40

41
00:02:33,670 --> 00:02:34,460
forwards.
41

42
00:02:34,480 --> 00:02:37,640
So in my code, I could have a line that addresses this.
42

43
00:02:37,660 --> 00:02:41,680
I could say, if there is an obstruction, then you should move
43

44
00:02:41,680 --> 00:02:42,250
right.
44

45
00:02:42,280 --> 00:02:43,610
So it moves right.
45

46
00:02:43,660 --> 00:02:48,990
And then, if there's no more obstructions, then you should move forwards or move towards the flagpole.
46

47
00:02:49,000 --> 00:02:54,910
So this is basically a really, really simple script that tells the robot to move to the flagpole covering
47

48
00:02:54,910 --> 00:02:56,260
the least amount of distance.
48

49
00:02:56,260 --> 00:03:01,540
Now, that's all very well and good. But what if the obstruction was over here or if it was down there,
49

50
00:03:01,840 --> 00:03:06,750
then my program would completely fail because it would just continue moving forwards,
50

51
00:03:06,910 --> 00:03:11,290
and it actually doesn't hit an obstruction, but it's also going nowhere near the flagpole.
51

52
00:03:11,320 --> 00:03:13,760
So this is a very simple example.
52

53
00:03:13,810 --> 00:03:19,090
Of course, you can make your program more complex by saying, you know, figure out what is the coordinate
53

54
00:03:19,240 --> 00:03:24,220
of the flagpole and try to reduce the distance between the robot and the flagpole.
54

55
00:03:24,220 --> 00:03:30,440
And if there is an obstruction, then dodge it left or right, and then continue trying to progress towards
55

56
00:03:30,440 --> 00:03:31,270
the flagpole.
56

57
00:03:31,270 --> 00:03:32,870
Now, that's definitely possible.
57

58
00:03:33,040 --> 00:03:39,250
But if instead, we employed machine learning, then we could simply tell the robot to find the shortest
58

59
00:03:39,250 --> 00:03:46,720
route to the flagpole, and it would, you know, maybe bump around and go in all sorts of different directions.
59

60
00:03:46,780 --> 00:03:51,130
But once it hits the flagpole, then we'll give it a reward and tell it, "You've got it right."
60

61
00:03:51,130 --> 00:03:57,010
And over time, if we keep training it, training it, and training it, and we get it to do this many, many times,
61

62
00:03:57,040 --> 00:04:02,670
then it'll learn to avoid obstructions and figure out the shortest route to the flagpole
62

63
00:04:03,070 --> 00:04:06,770
all without any explicit code writing on our part.
63

64
00:04:06,790 --> 00:04:12,070
So this is, essentially, the fundamentals of machine learning, and it's defined as the field of study that
64

65
00:04:12,070 --> 00:04:17,090
gives computers the ability to learn without being explicitly programmed.
65

66
00:04:17,350 --> 00:04:21,520
So the actual term machine learning was actually coined by this guy, Arthur Samuel.
66

67
00:04:21,700 --> 00:04:29,070
And he was the guy who first wrote what could be said as a machine learning algorithm to play checkers
67

68
00:04:29,110 --> 00:04:35,420
and he figured out a way of getting a robot to play checkers without telling it explicitly what to do.
68

69
00:04:35,530 --> 00:04:42,460
Instead, his code asked the machine to try and learn by itself and try and optimize itself over repeated
69

70
00:04:42,460 --> 00:04:42,910
games.
70

71
00:04:42,940 --> 00:04:47,560
So if you know anything about machine learning or if you know nothing about machine learning, the most
71

72
00:04:47,560 --> 00:04:52,460
important thing to remember is that it's usually split into two broad categories,
72

73
00:04:52,480 --> 00:04:57,250
so supervised machine learning or unsupervised machine learning.
73

74
00:04:57,310 --> 00:05:00,490
And this relates to how you train the machine learning model.
