A Gentle Introduction to Machine Learning — Transcript
Full transcript
- 0:00Going to start this StatQuest
- 0:02with a silly song.
- 0:05But if you don't like silly songs,
- 0:08that's okay.
- 0:10StatQuest.
- 0:13Hello, I'm Josh Starmer and welcome to
- 0:15StatQuest. Today, we're going to do a
- 0:17gentle introduction to machine learning.
- 0:21Note, this StatQuest was originally
- 0:23prepared for and presented at the
- 0:25Society for Scientific Advancement's
- 0:27annual conference.
- 0:29One of the things that SoSci does is
- 0:32promote science and technology in
- 0:34Jamaica.
- 0:36Let's start with a silly example.
- 0:39Do you like silly songs?
- 0:42If you like silly songs, are you
- 0:44interested in machine learning?
- 0:46If you like silly songs and machine
- 0:48learning, then you'll love StatQuest.
- 0:52If you like silly songs but not machine
- 0:55learning, are you interested in
- 0:56statistics?
- 0:58If you like silly songs and statistics
- 1:01but not machine learning, then you'll
- 1:03still love StatQuest.
- 1:06Otherwise, you might not like StatQuest.
- 1:09Wah-wah.
- 1:11If you don't like silly songs, are you
- 1:14interested in machine learning?
- 1:16If you don't like silly songs but you
- 1:19like machine learning, then you'll love
- 1:21StatQuest.
- 1:24If you don't like silly songs or machine
- 1:26learning, are you interested in
- 1:28statistics?
- 1:30If you don't like silly songs or machine
- 1:32learning but you're interested in
- 1:33statistics, then you will love
- 1:35StatQuest.
- 1:38Otherwise, you might not like StatQuest.
- 1:41Wah-wah.
- 1:44This is a silly example, but it
- 1:46illustrates a decision tree, a simple
- 1:48machine learning method.
- 1:50The purpose of this particular decision
- 1:52tree is to predict whether or not
- 1:54someone will love StatQuest.
- 1:58Alternatively, we could say that this
- 2:00decision tree classifies a person as
- 2:03either someone who loves StatQuest or
- 2:05someone who doesn't.
- 2:07Since decision trees are a type of
- 2:09machine learning,
- 2:11then if you understand how we use this
- 2:13tree to predict or classify if someone
- 2:16would love StatQuest, you are well on
- 2:18your way to understanding machine
- 2:20learning.
- 2:22Bam!
- 2:24Here's another silly example of machine
- 2:26learning.
- 2:28Imagine we measured how quickly someone
- 2:30could run 100 m
- 2:32and how much yam they ate.
- 2:35This is me.
- 2:37I'm not very fast and I don't eat much
- 2:40yam.
- 2:41These are some other people.
- 2:44And this is Usain Bolt.
- 2:47Usain Bolt is very fast and he eats a
- 2:50lot of yam.
- 2:52Given this pretend data, we see that the
- 2:55more yam someone eats, the faster they
- 2:57run the 100-m dash.
- 3:01We can fit a black line to the data to
- 3:03show the trend.
- 3:05But we can also use the black line to
- 3:07make predictions.
- 3:10For example, if someone told us they ate
- 3:12this much yam,
- 3:14then we could use the black line to
- 3:16predict how fast that person might run.
- 3:20This is the predicted speed.
- 3:23The black line is a type of machine
- 3:25learning because we can use it to make
- 3:27predictions.
- 3:29In general, machine learning is all
- 3:31about making predictions and
- 3:33classifications.
- 3:35Bam!
- 3:38Now that we can make predictions and
- 3:39classifications,
- 3:41let's talk about some of the main ideas
- 3:43in machine learning.
- 3:45First of all, in machine learning lingo,
- 3:48the original data is called training
- 3:50data.
- 3:52So, the black line is fit to training
- 3:54data.
- 3:56Alternatively, we could have fit a green
- 3:58squiggle to the training data.
- 4:01The green squiggle fits the training
- 4:03data better than the black line, but
- 4:05remember, the goal of machine learning
- 4:07is to make predictions.
- 4:09So, we need a way to decide if the green
- 4:11squiggle is better or worse than the
- 4:14black line at making predictions.
- 4:17So, we find a new person and measure how
- 4:20fast they run and how much yam they eat.
- 4:23And then we find another
- 4:25and another
- 4:27and another.
- 4:29Altogether, the blue dots represent
- 4:31testing data.
- 4:33We use the testing data to compare the
- 4:35predictions made by the black line
- 4:38to the predictions made by the green
- 4:40squiggle.
- 4:42Let's start by seeing how well the black
- 4:44line predicts the speed of each person
- 4:46in the testing data.
- 4:49Here's the first person in the testing
- 4:51data.
- 4:52They ate this much yam
- 4:55and they ran this fast.
- 4:58However, the black line predicts that
- 5:00someone who ate this much yam
- 5:02should run a little slower.
- 5:05So, let's measure the distance between
- 5:07the actual speed and the predicted speed
- 5:11and save the distance on the right while
- 5:13we focus on the other people in the
- 5:15testing data.
- 5:17Here's the second person in the testing
- 5:19data.
- 5:21They ate this much yam
- 5:23and they ran this fast.
- 5:25But, the black line predicts that they
- 5:27will run a little faster.
- 5:30So, we measure the distance between the
- 5:32actual speed and the predicted speed
- 5:35and add it to the one we measured for
- 5:37the first person in the testing data.
- 5:41Then, we measure the distance between
- 5:43the real and the predicted speed for the
- 5:45third person in the testing data,
- 5:48and add it to our running total of
- 5:50distances between the real and predicted
- 5:52speeds for the black line.
- 5:55Then we do the same thing for the fourth
- 5:57person in the testing data.
- 6:01And add that distance to our running
- 6:03total for the black line.
- 6:05This is the sum of all the distances
- 6:08between the real and predicted speeds
- 6:10for the black line.
- 6:12Now, let's calculate the distances
- 6:14between the real and predicted speeds
- 6:17using the green squiggle.
- 6:19Remember, the green squiggle did a great
- 6:22job fitting the training data.
- 6:24But when we are doing machine learning,
- 6:27we are more interested in how well the
- 6:28green squiggle can make predictions with
- 6:31new data.
- 6:33So, just like before, we determine this
- 6:36person's real speed
- 6:38and their predicted speed,
- 6:41and measure the distance between them.
- 6:44And just like we did for the black line,
- 6:47we'll keep track of the distances for
- 6:48the green squiggle over here.
- 6:52Then we do the same thing for the second
- 6:54person in the testing data.
- 6:57And the third person.
- 7:00And the fourth person.
- 7:03This is the sum of the distances between
- 7:05the real and predicted speeds for the
- 7:07green squiggle.
- 7:10The sum of the distances is larger for
- 7:12the green squiggle than the black line.
- 7:16In other words, even though the green
- 7:18squiggle fit the training data way
- 7:20better than the black line,
- 7:22the black line did a better job
- 7:24predicting speeds with the testing data.
- 7:28So, if we had to choose between using
- 7:30the black line or the green squiggle to
- 7:32make predictions,
- 7:34we would choose the black line.
- 7:37Bam!
- 7:40This example teaches two main ideas
- 7:42about machine learning.
- 7:44First, we use testing data to evaluate
- 7:47machine learning methods.
- 7:49Second, don't be fooled by how well a
- 7:52machine learning method fits the
- 7:54training data.
- 7:56Note, fitting the training data well but
- 7:59making poor predictions is called the
- 8:01bias-variance tradeoff.
- 8:04Oh, no, a shameless self-promotion.
- 8:08If you want to learn more about the
- 8:10bias-variance tradeoff, there's a
- 8:12StatQuest that will walk you through it
- 8:14one step at a time.
- 8:16Before we move on, you may be wondering
- 8:19why we used a simple black line and a
- 8:21silly green squiggle instead of a deep
- 8:24learning convolutional neural network
- 8:28or
- 8:29insert newest, bestest, most fancy
- 8:32machine learning method here.
- 8:36There are tons of fancy sounding machine
- 8:38learning methods.
- 8:40And each year, something new and
- 8:42exciting comes on the scene.
- 8:44But regardless of what you use, the most
- 8:47important thing isn't how fancy it is,
- 8:49but how it performs with testing data.
- 8:53Double bam.
- 8:56Now, let's go back to the decision tree
- 8:58that we started with.
- 9:00Remember, we wanted to classify if
- 9:03someone loves StatQuest based on a few
- 9:05questions.
- 9:08To create the decision tree, we
- 9:10collected data from people who love
- 9:11StatQuest
- 9:13and from people who did not love
- 9:15StatQuest.
- 9:17Altogether, this was the training data.
- 9:21And we used it to build the decision
- 9:23tree.
- 9:25Then we got data from a few more people
- 9:27who love StatQuest
- 9:30and a few more people who did not love
- 9:32StatQuest.
- 9:34Altogether, this forms the testing data.
- 9:39We can use the testing data to see how
- 9:41well our decision tree predicts if
- 9:43someone will love StatQuest.
- 9:46The first person in the testing data did
- 9:48not like silly songs.
- 9:50So we go to the right side of the
- 9:52decision tree.
- 9:55They didn't like machine learning
- 9:56either.
- 9:58So we just keep on going down the right
- 10:00side of the decision tree.
- 10:03They didn't like statistics either.
- 10:06So the decision tree predicts that this
- 10:08person will not love StatQuest.
- 10:11However, this person loves StatQuest, so
- 10:15the decision tree made a mistake.
- 10:17Wah-wah.
- 10:20The second person in the testing data
- 10:22liked silly songs.
- 10:24And that takes us down the left side of
- 10:27the decision tree.
- 10:29They were also interested in machine
- 10:31learning.
- 10:33So we predict that that person loves
- 10:35StatQuest.
- 10:38And since this person actually loves
- 10:40StatQuest, the decision tree did a good
- 10:42job.
- 10:44Hooray!
- 10:46Now we just run all of the other people
- 10:48in the testing data down the decision
- 10:50tree and compare the predictions to
- 10:53reality.
- 10:55Then we can compare this decision tree
- 10:57to the latest greatest machine learning
- 10:59method.
- 11:01Ultimately, we pick the method that does
- 11:03the best job predicting if someone will
- 11:05love StatQuest or not.
- 11:09Triple bam!
- 11:12In summary,
- 11:13machine learning is all about making
- 11:16predictions and classifications.
- 11:19There are tons of fancy machine learning
- 11:21methods, but the most important thing to
- 11:23know about them isn't what makes them so
- 11:25fancy.
- 11:27It's that we decide which method fits
- 11:29our needs the best by using testing
- 11:31data.
- 11:33One last thing before we go.
- 11:36You may be wondering how we decide which
- 11:38data go into the training set and which
- 11:41data go into the testing set.
- 11:44Earlier, we just arbitrarily decided
- 11:47that these red dots were the training
- 11:48data.
- 11:50But the blue dots could have just as
- 11:53easily been the training data.
- 11:56The good news is that there are ways to
- 11:58determine which samples should be used
- 12:00for training data and which samples
- 12:02should be used for testing data.
- 12:05And if you're interested in learning
- 12:07more about this, check out the
- 12:08StatQuest.
- 12:10And there are lots more StatQuests that
- 12:12walk you through machine learning
- 12:14concepts step-by-step, so check them
- 12:17out.
- 12:19Hooray! We've made it to the end of
- 12:21another exciting StatQuest. If you like
- 12:24this StatQuest and want to see more,
- 12:26please subscribe.
- 12:28And if you want to support StatQuest,
- 12:29well, consider buying one or two of my
- 12:31original songs or getting a t-shirt or a
- 12:34hoodie or some other slick merchandise.
- 12:37There's links on the screen and there's
- 12:39links in the description below. All
- 12:41right, until next time, quest on.
About this transcript
This page contains the full transcript of A Gentle Introduction to Machine Learning by StatQuest with Josh Starmer, generated from the public captions YouTube serves with the video. The transcript has 1,726 words across 323 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.