Machine learning is about giving computers the ability to learn without being explicitly programmed. Although this course is meant to deliver a very practical approach to the Apple machine learning framework, Core ML, understanding the theory behind it helps you understand the new opportunities, as well as the limitations of machine learning on iOS.
- [Instructor] With this course you're going to learn a very practical approach to machine learning in the context of iOS development. Nevertheless I'd like to give you a few pieces of theory on machine learning to help you understand the underlying processes of what we're actually doing. So let's first of all answer the question of what machine learning is by having a look at the short definition which comes from an American pioneer in the field of computer gaming and artificial intelligence, which is Arthur Samuel.
He really coined this term of machine learning, and that already back in 1959 working at IBM. He said that, "machine learning is about giving computers the ability to learn without being explicitly programmed." But how can we do that? What approaches and methods exist to do that? I'd like to give you two examples. First of all, decision tree learning, and second, deep learning. Two very important approaches to machine learning.
Decision tree learning is actually pretty simple. Let's assume that we have a model that we want to create a model that determines if a name is female or male. And we would be looking maybe at the last letter, and if the last letter is equal to eight, then this most likely is going to be a girls name. And if not, it could be an N as a last letter. And if that is true, then this could be a boys name with a very high probability. So decision tree learning uses a decision tree as a predictive model which maps observations about an item to conclusions about the item's target value.
Let's now have a look at deep learning and artificial neural networks, which are really, really interesting. Neural networks are a beautiful biologically inspired programming paradigm which enables computers to learn from observational data. You're going to see an example about that in a second. And deep learning, both neural networks and deep learning are really connected because deep learning is a powerful set of techniques for learning in neural networks. So you now understand these terms and how they are connected and what a neural network actually is.
It is a programming paradigm, and I'd like to give you an example for why we should be using these artificial neural networks for some complicated tasks like image recognition for speech recognition or natural language processing in short, NLP. And Core ML is also very related to these topics. We're going to see all of that in practice, but for these examples we're using artificial neural networks and deep learning. And I'd like to explain how this actually works now in more detail.
Let's assume that we want to recognize this number, and the difficulty of visual pattern recognition becomes apparent if you attempt to write a computer program to recognize digits like these you're seeing right now. What seems easy when we do it ourselves, suddenly becomes extremely difficult. Simple intuitions about how we recognize shapes like a nine has a loop at the top and a vertical stroke in the bottom right, turn out to be not so simple at all. When you try to makes such rules precise, you quickly get lost in a morass of exceptions and caveats and special cases, and it actually seems kind of hopeless.
So what can we do about that? Well neural networks approached the problem in a different way, the idea is to take a large number of handwritten digits known as training examples, and then develop a system which can learn from those training examples. And in other words, the neural network uses the examples to automatically infer rules for recognizing handwritten digits and furthermore by increasing the number of training examples the network can learn more about handwriting and still improve it's accuracy.
But how does a neural network do that? The process is kind of complicated, but I'd like to simplify that, so that we can understand that for all purposes using Core ML in iOS. So a neural network consists of three major components, an input layer, hidden layers and an output layer. In our example the input layer of the network contains neurons encoding the values of the input pixels. In our example our training data for the network will consist of many 20x20 pixel images of scanned handwritten digits.
And so the input layers would contain 400 neuron. The one input layer would contain 400 neurons because 20 times 20 equals 400. And then we have a bunch of hidden layers that are processing this data, and then conclude in the output layer, which triggers one neuron, or the hidden layers are going to trigger one neuron in the output layer to tell us which number was actually recognized. And this is a very brief explanation.
It is a little bit more complicated than that especially if we're talking about self learning, but for us this is going to be enough to understand the basic principle. But then what about deep learning? The real breakthrough in deep learning was to realize that it's practical to go beyond the shallow hidden layer networks that dominated work until the mid 2000s, and that really was a significant breakthrough, opening up to exploration of much more expressive models but beyond that, the number of layers is not of primary fundamental interest.
Rather, the use of deeper networks is a tool to use to help achieve other goals like better classification accuracies for handwriting for image recognition and so on. And now you might say that, "I'm an iOS developer and not a data scientist, why do I need to know that?", and "Can't I skip all of that, do I really need that?" The beauty of that is that you now understand the principles that are fundamental to Core ML, but using Core ML does not require us to do any of the stuff we just heard about.
Core ML is giving us the tools to just do image recognition, to just do natural language processing, to just do things like speech recognition and so on. Just getting a model and using it. And how this works is what we're going to learn next.
- What are machine learning, Core ML, Vision, and NLP?
- Adding a machine learning model to a project
- Getting predictions from machine learning models
- Converting existing machine learning models for Core ML
- Classifying images and detecting objects with Vision and Core ML
- Analyzing natural language text with NSLinguisticTagger