Allstate NI placement students create AI Minecraft project for kids

Have you ever finished watching a Minecraft video on YouTube and suddenly you're being recommended to watch another one? Have you wondered how YouTube knows that you'll be interested in the new suggestion? How about when you ask Siri to set a timer for 10 minutes and the countdown begins with no hesitation? How can a voice on your phone do a task just as a human would?

The answer is AI, or Artificial Intelligence. It might be that you have never realized it, but AI is used everywhere in the world around us. It is because of AI that you alone can unlock your phone by showing your face to it. It is because of AI that some Tesla cars can drive themselves to whichever destination you want to go. It is because of AI that Iron Man created Jarvis to help assist him in his suit.

Machine learning and artificial intelligence - for ages 10 - 15.

Now you may be asking yourself how any of these things are possible? What exactly is Artificial Intelligence and how can it do these amazing things? To put it simply, AI can learn and think just like you and me. In the same way that you could recognize a celebrity in real life because you've seen countless pictures of them, AI can do the exact same thing.

So how does AI work? Well, AI uses fancy recipes, known as algorithms, to find the 'smartest' answer. Let's consider the recipe for homemade cottage pie — your mum and your granny may have completely different tasty recipes, so we know that not all recipes are the same. Similarly, all algorithms are not the same even if they are doing the same thing.

What if I asked you to cook your granny's world-famous cottage pie? Could you do it? Maybe you could, if she provided you with the recipe. However, here's the catch — she's locked up the recipe and now you must try to recreate it from scratch. Could you do it now? Again, maybe you could, but it would take countless different attempts just to get it right. It would take time and energy that I'm sure you don't have. On the other hand, a computer couldn't care less if it took centuries to guess the recipe. Computers don't get tired. So, we get one computer to guess the recipe, and get a second computer that already knows the recipe. Then the second computer can let the first computer know how close it is getting to the true combination of ingredients.

The guessing game that the computer is playing is just like the hot and cold game that you played when you were a kid. When someone gets closer to finding the hidden object, they are told that they are getting hotter, and when they stray from the object, they are told they're getting colder. The computer is told when it is 'getting hotter' to the correct recipe.

This is how AI learns. AI learns from its mistakes, and trains itself on tons of incorrect answers until it gets very close to the correct one. After each mistake, it will make a small adjustment using maths tricks in the hopes of edging closer to the real cottage pie recipe. This process is known as Machine Learning.

Once the computer arrives at a decent recipe that everybody agrees is really good, the combinations and adjustments that the algorithm made are noted. Now we refer to the decent recipe algorithm as a 'machine learning model'. Anytime we want some of granny's cottage pie when she isn't around, we can now grab this Model and it will make us a pretty good version of granny's cottage pie as many times as we would like.

Pretty cool, right? It's not exactly rocket science!

So now you've got the basics to machine learning, let's talk about something called image classification.

Have a look at the drawing below.

A drawing of a car.

What do you notice about this image? There are wheels, a door, headlights, windows, a roof and so on. Putting all these pieces together, we recognize this image as a car. These characteristics are called 'features' of the car. We can teach a computer to filter out these features. We can train it to say if you saw a door, wheels, headlights and roof connected together, call it a car. That's how image classification works. In fact, modern machine learning algorithms can 'figure out' what features to pay attention to by itself, just by looking at tons of examples. This makes us think that the algorithm is artificially intelligent, but we know better than that. We know what’s going on behind the scenes.

Deciding if a photo is a car, a bus or a train is called classification. An algorithm that identifies a car, a bus, a train, etc. is called a classifier. There are tons of classifiers out there that can identify dogs from cats and roads from trees. In fact, a Tesla has very sophisticated computer vision (a model that works with images) classifier that helps it make steering wheel adjustments to keep it in its lane on the road.

Okay, so now you have the basics to image classification, it's time to take it up a notch.

So, at the end of this article you are going to put everything you've learnt so far to the test. You are going to build your very own Minecraft themed image classifier!

Your Minecraft classifier is going to look at images of mobs and guess whether they will be a threat to us or not. For example, it might look at an image and notice features, such as four short legs, a tall green and white pixelated body and recognize this as a Creeper. It will then tell us that Creepers are a threat to our character.

So, just like we talked about before, we want to make our Minecraft image classifier guess correctly as much as possible — for the sake of our virtual lives. We want to play the hot and cold game on the classifier to help it 'get hotter' to the right answers. One way we can do this is to take all the images that the classifier got wrong and show them to the classifier again. Only this time, we will give it the correct answer with the image. This will help the model to learn from its mistakes and perform better in the future. The fancy term for this is 'Optimizing the Loss Function'.

See, even for computers practice makes perfect.

I bet you can't wait to build your very own image classifier, but before you do, let's do a quick recap of what we've learnt so far…

  • AI uses a bunch of recipe lists to come up with 'smart' answers. We call these recipes Algorithms.
  • AI can figure out the rules of what a car or a train looks like just by looking at tons of examples and learning from its mistakes.
  • An image classifier looks for features in an image to identify the object.
  • We need to play a game of hot or cold to make our models more accurate.
  • Machine learning is fun!

Congratulations if you made it to the end of this article!

You now have the knowledge you need to get coding a real-life image classifier! You see, machine learning takes some 'simple' formulas and turns them into something cool.

What else do you think image classifiers could be used for?

Learn how to build a model that will decide if I'm dangerous or not!

Minecraft character.

Choose your level to start coding!

EasyHard