Machine Learning — Teaching Machines to Learn
Machine Learning — Teaching Machines to Learn
Brains are quite simply the most amazing things. Do you want to know what’s more fascinating to me? Our ability to learn. How we’re able to adapt and learn completely new skills and form these new neural pathways.
I have a little brother who’s 6 years old and I’ve seen him grow up from a crying little helpless baby to a small human. He learned how to crawl, then to walk, run, how to form words, he learned to understand grammar, he learned to do basic math. I still remember the day that my parents brought him home. It absolutelyblows my mind
Now I’m going to tell you about how we’re working on replicating this ability to learn in machines.
Let’s say I wanted to teach a machine how to distinguish between a dog and a cat. Fairly simple, my brother can easily do it. But how would you program it in a machine? We can’t say that all cats have pointy ears or all dogs have fur. If we were to approach this problem by trying to write down in code what all the differences between cats and dogs are, it would quickly be very tedious and there’s a very low chance that we would succeed.
With machine learning, these algorithms would be able to understand the differences between cats and dogs without being explicitly programmed. It requires no direction by us on how to differentiate between cats and dogs. The algorithm only looks at many, many different pictures of cats and dogs and learns the differences.
This is very similar to how my brother learned to tell the difference between cats and dogs. My mom didn’t tell him the differences, she just told him that a certain picture showed a dog and another one showed a cat and over time he learned for himself what dogs looked like and what cats looked like.
To sum up, machine learning allows machines to learn how to perform tasks without being explicitly programmed on how to.
Deep Learning
So we know what machine learning is, what the heck is deep learning?
Very simply, deep learning is simply a field within machine learning.
Deep learning algorithms are called neural networks and they’re modeled off of the human brain and how we learn! Basically, they’re just imitating my 6-year-old brother’s brain and how he learns, but these neural networks have been drastically way more effective at learning than any human ever. I’ll go into the applications a bit later, but first, let’s teach ourselves about how they’re able to learn so effectively!
Let’s take the example of differentiating between cats and dogs to understand how neural networks work. At its very essence, a neural network takes in an input, so in this case pictures of cats and dogs, and gets to the output, in this case, a label of whether a picture is a cat or a dog. In between the input and the output, is the hidden layer which extracts features from the images so, for example, this picture has a long nose, sharp teeth, a tail, etc, then using this information tries to predict whether this is a cat or a dog.
Sometimes the features are important like more often than not, dogs have longer noses than cats, and other times they’re absolutely irrelevant like having tails. To combat this problem, these networks give certain features more weight than others by saying that if a picture has a long nose then it’s a higher likelihood of being a dog. In the end, a ton of features come together and the network decides if enough of the features say it’s probably a dog, then it’s going to output that this picture is a dog.
But hey, what if it’s wrong? Surely it can’t get everything right the first time! My brother thought Canadian geese were chickens were for a full 6 months. This is where the learning happens. The neural network says that a picture is a cat, but the label shows that it’s actually a dog!
What happens is that it goes to the hidden layer where the neural network makes the decision on what weight to put on what features. If it made a mistake, the network must adjust how these different features are weighted to get the right result. By tweaking its understanding, eventually, the neural network will be able to tell the difference between the two!
I was actually able to build this and got around a 95% accuracy rate on this! Not perfect, but still amazing results!
Overview of the Different Problems ML Can Solve
So within machine learning, there are 3 different branches and they all strive to solve a different type of problem and it’s important to understand all 3!
Supervised Learning
Supervised learning is what I’ve explained to you so far because it’s the easiest to understand. We’re given an input, and told what the output is. We get an image of a cat and we know that it is labeled a cat. By putting the right weight on the right features, it gets to the right output of the picture is a cat.
A quick analogy is that say you’re studying for a cell biology test. You’re testing yourself for the functions of the different parts of a cell. You’re reading the cell parts, the inputs, and matching them to the outputs, the function of the cell parts. You’re learning how to get from the input to the output!
Unsupervised Learning
Unsupervised learning is a dataset but there are no labels or no right answers in this case. It just has data points and the purpose of unsupervised learning is just to find patterns in the data and help draw conclusions.
So let’s take shapes as an example. A supervised learning algorithm would be given a square, told it’s a square, a triangle, told it’s a triangle, etc. It would then understand what makes a square, a square, and what makes a triangle, a triangle, etc.
In an unsupervised learning problem, it would be just given a bunch of shapes without being told what kind of shape they are. In this case, the unsupervised learning algorithm would simply then group together similar shapes, might be shapes with the same amount of sides, shapes will similar areas, shapes with similar colours. It would find an underlying pattern and group the shapes together.
This is an example of how an unsupervised learning algorithm would try to find patterns in the data points. The algorithm decided that this was the best split between the data points because all the yellow points are most similar to other yellow points, all the red points are most similar to the other red points, and all the blue points are most similar to the other blue points.
Reinforcement Learning
This is actually my favourite topic within machine learning and the one that I devote all my time in terms of coding and learning! What drew me in was this video and other videos and applications like it!
WHAT?! HOW?! EXCUSE ME?!
This blows my mind every time! This is reinforcement learning in action!
Reinforcement learning is basically an agent understanding how to maximize reward in an environment. In this case, a reward is given when an agent manages to walk. Tomaximize this reward, it will try to continue walking for as long as it can.
The agent does this by experimenting with all the possible leg movements and finally manages to stand up. The agent gets a reward for this, so it continues to stand up and repeats that action. When it takes a step, it gets more reward than when it just stood up. So it continues to stand up and take a step. Then it experiments some more and figures out if it keeps taking more steps, it gets a lot more reward than when it just took one step. So it continues taking steps and for each step gets more and more reward!
Simple enough analogy, when my brother was learning to walk, my mom would clap and cheer when he took a step. When he fell down, he got hurt. So he stopped doing the actions that led him to fall and continue to take steps that made my mom clap and cheer. Eventually, he learned to run and now it’s second nature to him and all of us.
Reinforcement learning blows my mind every single time! I’ve managed to code a self-driving car in a virtual environment and trained an AI to play Doom and it’s so rewarding each time to see them succeed in the environment.
Applications
Let’s talk about some of the real world things, machine learning can do!
Natural Language Processing (NLP)
Computers talk in 0s and 1s and we talk in words. There’s a gap between how we talk and how computers talk and we have to be able to train computers to understand our language. With NLP, computers are not only able to transcribe words, but they’re able to extract meaning from them and even talk back with some intonation and tone! With assistants like Siri, Alexa, and Cortana, talking to our phones and devices is eventually going to be as common as using the keyboard on our phones.
Computer Vision (CV)
NLP gives computers the ability to talk, CV gives computers sight. It’s what they use in self driving cars to detect different objects like other cars, people, the lanes on the road. This is what gives computers the ability to extract meaning from cameras. This can even be used for simple face recognition and detection algorithms like the ones they use on Facebook!
Analyzing Health Data
Imagine this: Mark goes for a walk everyday through the park near his house, but suddenly one day he falls down and has a heart attack. Heart attacks like many other diseases and illnesses are very sudden with little to no physical warning. Or so we think… There are patterns in our body that are indicators of certain health events that will happen soon. This may in the form of genes, or buildup of plaque in the brain, or blood pressure patterns. With devices like Fitbits that track a portion of the data in our bodies, we might be able to analyze this data and start predicting health events in advance. So one week before Mark actually has the heart attack, the doctors already know so they can give him the help he needs before he even has the heart attack! Insane!
Generating Molecular Structures
There’s been massive interest around new materials like carbon nanotubes lately and all the things that they can do. Well if we think about it, carbon nanotubes are just carbon atoms in a specific pattern. This pattern is what gives the nanotubes the properties that are super valuable to us. What if we could get a computer to generate these structures? What if by learning the rules of physics and chemistry, it could start to generate new materials that are stronger, that are more optimized, that are overall just better than any other material we have? At its very core, it’d only be generating different patterns with a specific set of constraints.
Let’s take this a bit further into a field that I’m currently in love with and am working on! Drug Discovery. Discovering new drugs with computers. Generating new molecular sequences with the constraints of chemistry, the receptors that the drug targets, the interactions the drug needs to have, and many more things. But, this is absolutely insane! Imagine what would happen with increased computational power? Even if you had a disease that nobody had ever seen. Given some information as to what is wrong in your body, we could immediately generate a drug that helped you with little to no side effects. How insane is that?! Blows my mind everytime I think about it!
Key Takeaways
- Machine learning allows machines to learn how to perform tasks without being explicitly programmed on how to.
- Deep learning is a subset of machine learning that uses a specific algorithm called neural networks which are modeled off of the brain.
- Supervised learning has an input and an output, and it aims to figure out how to get from the input to the output. Unsupervised learning has data points and it’s objective is just to find a pattern within the data.
- Reinforcement learning is how robots can learn to walk, jump, and perform other human like actions both in the physical and virtual world.
- The potential for machine learning and deep learning are absolutely insane! It’s going to completely change the world in a way that it has never been before! Get excited!!
Before you go:
1. Clap this post.
2. Share with your network!
3. Connect with me on linkedin!