image
How Does Machine Learning Actually Work?
Start course
Difficulty
Beginner
Duration
33m
Students
342
Ratings
4.6/5
Description

This course introduces machine learning on Google Cloud Platform. 

Learning Objectives

  • What machine learning actually means
  • The types of problems machine learning can solve
  • The basics of how machine learning works

Intended Audience

  • Anyone interested in machine learning

Prerequisites 

  • A basic understanding of computers
Transcript

Alright, so you understand what the definition of machine learning is.  But how does it actually work?  Well, basically it’s via pattern recognition.  You feed in lots of data so that it can identify patterns.  And then it uses those patterns to create a mathematical or statistical model.  This model is what stores those recognizable patterns in a usable format.  So you can think of a model as just a file that has been trained to recognize certain types of patterns.  And you can use this model to make decisions or classify new data. 

In order to create a model, you need both an input dataset and an algorithm.  Now the dataset can come in many different forms.  It can be a collection of numbers (like temperatures, ages, or costs).  It can be a collection of media (like photos, music or videos).  Or it can be just about anything else.  The learning algorithm is what converts the data into a mathematical representation.  These algorithms usually come from statistics, calculus, or even linear algebra.  By feeding the dataset through the algorithm, you produce a model.  And to use the model, you feed in new data as inputs and receive the result as an output.  

The inputs are called features.  A machine learning model can have one or more features.  So a model that is used to identify pictures of dogs, might have a single feature.  A model that predicts the value of a car, could have multiple features.  If your model requires multiple features, then those are grouped into instances or examples.  So each car that was fed into this model would be an example.  And each value for that car is a feature.  Features represent values that are used for calculating the result. 

The outputs are called labels.  So once you have a working model, you should be able to feed in one or more features and it should be able to output the appropriate labels.

Now machine learning models are only as good as the data they were trained on and the algorithm that you picked.  So selecting the right combination is very important.  A particular model might not work very well if the input dataset was too small or too big.  Also, picking the wrong kind of algorithm can create other issues.

Now a small training dataset can create a problem known as underfitting.  Underfitting means that your model was not able to properly identify the patterns in the data.  This is typically caused by undertraining.  However, if you train your model too much, it can result in overfitting.  Overfitting is when your model has been too specialized to your training dataset.  And that means it cannot accurately work on any new data.  So creating a model is a delicate balancing act.  

Now it is important to understand that machine learning models are rarely 100% accurate.  Just like people, models also make mistakes.  So all outputs are technically classified as predictions.  A machine learning model typically won’t say “this is a dog”.  What it will usually say is something like “I am 87% sure this is a dog.”  

Now, this makes sense if you think about it.  If I show you an image like this, you might say that you are 100% certain that it is a dog.  But what if I showed you this image?  Now maybe you are only about 70% sure.  How about this one?  Well it looks like it could be a dog.  But it’s hard to tell.  It might be some other kind of animal.

Machine Learning works the same way.  Every output is actually a prediction.  And some predictions it will be quite confident about.  But others might be less.

So you train the model with a dataset, and then you test it.  If its predictions are accurate enough, then you know you have a useful model.   But how do you define what “accurate enough” means?  Well, that is what evaluation metrics are for.  Evaluation metrics tell you mathematically how close your model’s predictions are to reality.  And different metrics are used to measure different things.

So let's go through some examples:

  • Loss indicates how bad a prediction for a single instance

  • Accuracy is the total percentage correct for all predictions made

  • Precision is the ratio of accurate predictions to false positives

  • Recall is the ratio of accurate predictions to false negatives

So you can use these (and other) evaluation metrics to help tune your model to make it more accurate.  

Now, even when you do produce a useful model, over time it is probably going to get less accurate.  Information and trends are constantly changing.  And so your models will eventually need to be updated with new data.  This is called retraining.  Now if you are trying to predict something really volatile, like housing prices or stock market fluctuations, you may need to constantly retrain your models.

So that’s it.  That’s basically how machine learning works.  In practice, a lot of effort is spent in collecting and labeling the data.  There is also a bunch of complicated math.  And a significant amount of time is spent on training.  But this should give up a basic understanding of the process.

About the Author
Students
37100
Courses
44
Learning Paths
16

Daniel began his career as a Software Engineer, focusing mostly on web and mobile development. After twenty years of dealing with insufficient training and fragmented documentation, he decided to use his extensive experience to help the next generation of engineers.

Daniel has spent his most recent years designing and running technical classes for both Amazon and Microsoft. Today at Cloud Academy, he is working on building out an extensive Google Cloud training library.

When he isn’t working or tinkering in his home lab, Daniel enjoys BBQing, target shooting, and watching classic movies.