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