YouTube2Text

A Gentle Introduction to Machine Learning — Transcript

by StatQuest with Josh Starmer · 1,726 words · 323 segments · language en · Watch on YouTube

Full transcript

  1. 0:00Going to start this StatQuest
  2. 0:02with a silly song.
  3. 0:05But if you don't like silly songs,
  4. 0:08that's okay.
  5. 0:10StatQuest.
  6. 0:13Hello, I'm Josh Starmer and welcome to
  7. 0:15StatQuest. Today, we're going to do a
  8. 0:17gentle introduction to machine learning.
  9. 0:21Note, this StatQuest was originally
  10. 0:23prepared for and presented at the
  11. 0:25Society for Scientific Advancement's
  12. 0:27annual conference.
  13. 0:29One of the things that SoSci does is
  14. 0:32promote science and technology in
  15. 0:34Jamaica.
  16. 0:36Let's start with a silly example.
  17. 0:39Do you like silly songs?
  18. 0:42If you like silly songs, are you
  19. 0:44interested in machine learning?
  20. 0:46If you like silly songs and machine
  21. 0:48learning, then you'll love StatQuest.
  22. 0:52If you like silly songs but not machine
  23. 0:55learning, are you interested in
  24. 0:56statistics?
  25. 0:58If you like silly songs and statistics
  26. 1:01but not machine learning, then you'll
  27. 1:03still love StatQuest.
  28. 1:06Otherwise, you might not like StatQuest.
  29. 1:09Wah-wah.
  30. 1:11If you don't like silly songs, are you
  31. 1:14interested in machine learning?
  32. 1:16If you don't like silly songs but you
  33. 1:19like machine learning, then you'll love
  34. 1:21StatQuest.
  35. 1:24If you don't like silly songs or machine
  36. 1:26learning, are you interested in
  37. 1:28statistics?
  38. 1:30If you don't like silly songs or machine
  39. 1:32learning but you're interested in
  40. 1:33statistics, then you will love
  41. 1:35StatQuest.
  42. 1:38Otherwise, you might not like StatQuest.
  43. 1:41Wah-wah.
  44. 1:44This is a silly example, but it
  45. 1:46illustrates a decision tree, a simple
  46. 1:48machine learning method.
  47. 1:50The purpose of this particular decision
  48. 1:52tree is to predict whether or not
  49. 1:54someone will love StatQuest.
  50. 1:58Alternatively, we could say that this
  51. 2:00decision tree classifies a person as
  52. 2:03either someone who loves StatQuest or
  53. 2:05someone who doesn't.
  54. 2:07Since decision trees are a type of
  55. 2:09machine learning,
  56. 2:11then if you understand how we use this
  57. 2:13tree to predict or classify if someone
  58. 2:16would love StatQuest, you are well on
  59. 2:18your way to understanding machine
  60. 2:20learning.
  61. 2:22Bam!
  62. 2:24Here's another silly example of machine
  63. 2:26learning.
  64. 2:28Imagine we measured how quickly someone
  65. 2:30could run 100 m
  66. 2:32and how much yam they ate.
  67. 2:35This is me.
  68. 2:37I'm not very fast and I don't eat much
  69. 2:40yam.
  70. 2:41These are some other people.
  71. 2:44And this is Usain Bolt.
  72. 2:47Usain Bolt is very fast and he eats a
  73. 2:50lot of yam.
  74. 2:52Given this pretend data, we see that the
  75. 2:55more yam someone eats, the faster they
  76. 2:57run the 100-m dash.
  77. 3:01We can fit a black line to the data to
  78. 3:03show the trend.
  79. 3:05But we can also use the black line to
  80. 3:07make predictions.
  81. 3:10For example, if someone told us they ate
  82. 3:12this much yam,
  83. 3:14then we could use the black line to
  84. 3:16predict how fast that person might run.
  85. 3:20This is the predicted speed.
  86. 3:23The black line is a type of machine
  87. 3:25learning because we can use it to make
  88. 3:27predictions.
  89. 3:29In general, machine learning is all
  90. 3:31about making predictions and
  91. 3:33classifications.
  92. 3:35Bam!
  93. 3:38Now that we can make predictions and
  94. 3:39classifications,
  95. 3:41let's talk about some of the main ideas
  96. 3:43in machine learning.
  97. 3:45First of all, in machine learning lingo,
  98. 3:48the original data is called training
  99. 3:50data.
  100. 3:52So, the black line is fit to training
  101. 3:54data.
  102. 3:56Alternatively, we could have fit a green
  103. 3:58squiggle to the training data.
  104. 4:01The green squiggle fits the training
  105. 4:03data better than the black line, but
  106. 4:05remember, the goal of machine learning
  107. 4:07is to make predictions.
  108. 4:09So, we need a way to decide if the green
  109. 4:11squiggle is better or worse than the
  110. 4:14black line at making predictions.
  111. 4:17So, we find a new person and measure how
  112. 4:20fast they run and how much yam they eat.
  113. 4:23And then we find another
  114. 4:25and another
  115. 4:27and another.
  116. 4:29Altogether, the blue dots represent
  117. 4:31testing data.
  118. 4:33We use the testing data to compare the
  119. 4:35predictions made by the black line
  120. 4:38to the predictions made by the green
  121. 4:40squiggle.
  122. 4:42Let's start by seeing how well the black
  123. 4:44line predicts the speed of each person
  124. 4:46in the testing data.
  125. 4:49Here's the first person in the testing
  126. 4:51data.
  127. 4:52They ate this much yam
  128. 4:55and they ran this fast.
  129. 4:58However, the black line predicts that
  130. 5:00someone who ate this much yam
  131. 5:02should run a little slower.
  132. 5:05So, let's measure the distance between
  133. 5:07the actual speed and the predicted speed
  134. 5:11and save the distance on the right while
  135. 5:13we focus on the other people in the
  136. 5:15testing data.
  137. 5:17Here's the second person in the testing
  138. 5:19data.
  139. 5:21They ate this much yam
  140. 5:23and they ran this fast.
  141. 5:25But, the black line predicts that they
  142. 5:27will run a little faster.
  143. 5:30So, we measure the distance between the
  144. 5:32actual speed and the predicted speed
  145. 5:35and add it to the one we measured for
  146. 5:37the first person in the testing data.
  147. 5:41Then, we measure the distance between
  148. 5:43the real and the predicted speed for the
  149. 5:45third person in the testing data,
  150. 5:48and add it to our running total of
  151. 5:50distances between the real and predicted
  152. 5:52speeds for the black line.
  153. 5:55Then we do the same thing for the fourth
  154. 5:57person in the testing data.
  155. 6:01And add that distance to our running
  156. 6:03total for the black line.
  157. 6:05This is the sum of all the distances
  158. 6:08between the real and predicted speeds
  159. 6:10for the black line.
  160. 6:12Now, let's calculate the distances
  161. 6:14between the real and predicted speeds
  162. 6:17using the green squiggle.
  163. 6:19Remember, the green squiggle did a great
  164. 6:22job fitting the training data.
  165. 6:24But when we are doing machine learning,
  166. 6:27we are more interested in how well the
  167. 6:28green squiggle can make predictions with
  168. 6:31new data.
  169. 6:33So, just like before, we determine this
  170. 6:36person's real speed
  171. 6:38and their predicted speed,
  172. 6:41and measure the distance between them.
  173. 6:44And just like we did for the black line,
  174. 6:47we'll keep track of the distances for
  175. 6:48the green squiggle over here.
  176. 6:52Then we do the same thing for the second
  177. 6:54person in the testing data.
  178. 6:57And the third person.
  179. 7:00And the fourth person.
  180. 7:03This is the sum of the distances between
  181. 7:05the real and predicted speeds for the
  182. 7:07green squiggle.
  183. 7:10The sum of the distances is larger for
  184. 7:12the green squiggle than the black line.
  185. 7:16In other words, even though the green
  186. 7:18squiggle fit the training data way
  187. 7:20better than the black line,
  188. 7:22the black line did a better job
  189. 7:24predicting speeds with the testing data.
  190. 7:28So, if we had to choose between using
  191. 7:30the black line or the green squiggle to
  192. 7:32make predictions,
  193. 7:34we would choose the black line.
  194. 7:37Bam!
  195. 7:40This example teaches two main ideas
  196. 7:42about machine learning.
  197. 7:44First, we use testing data to evaluate
  198. 7:47machine learning methods.
  199. 7:49Second, don't be fooled by how well a
  200. 7:52machine learning method fits the
  201. 7:54training data.
  202. 7:56Note, fitting the training data well but
  203. 7:59making poor predictions is called the
  204. 8:01bias-variance tradeoff.
  205. 8:04Oh, no, a shameless self-promotion.
  206. 8:08If you want to learn more about the
  207. 8:10bias-variance tradeoff, there's a
  208. 8:12StatQuest that will walk you through it
  209. 8:14one step at a time.
  210. 8:16Before we move on, you may be wondering
  211. 8:19why we used a simple black line and a
  212. 8:21silly green squiggle instead of a deep
  213. 8:24learning convolutional neural network
  214. 8:28or
  215. 8:29insert newest, bestest, most fancy
  216. 8:32machine learning method here.
  217. 8:36There are tons of fancy sounding machine
  218. 8:38learning methods.
  219. 8:40And each year, something new and
  220. 8:42exciting comes on the scene.
  221. 8:44But regardless of what you use, the most
  222. 8:47important thing isn't how fancy it is,
  223. 8:49but how it performs with testing data.
  224. 8:53Double bam.
  225. 8:56Now, let's go back to the decision tree
  226. 8:58that we started with.
  227. 9:00Remember, we wanted to classify if
  228. 9:03someone loves StatQuest based on a few
  229. 9:05questions.
  230. 9:08To create the decision tree, we
  231. 9:10collected data from people who love
  232. 9:11StatQuest
  233. 9:13and from people who did not love
  234. 9:15StatQuest.
  235. 9:17Altogether, this was the training data.
  236. 9:21And we used it to build the decision
  237. 9:23tree.
  238. 9:25Then we got data from a few more people
  239. 9:27who love StatQuest
  240. 9:30and a few more people who did not love
  241. 9:32StatQuest.
  242. 9:34Altogether, this forms the testing data.
  243. 9:39We can use the testing data to see how
  244. 9:41well our decision tree predicts if
  245. 9:43someone will love StatQuest.
  246. 9:46The first person in the testing data did
  247. 9:48not like silly songs.
  248. 9:50So we go to the right side of the
  249. 9:52decision tree.
  250. 9:55They didn't like machine learning
  251. 9:56either.
  252. 9:58So we just keep on going down the right
  253. 10:00side of the decision tree.
  254. 10:03They didn't like statistics either.
  255. 10:06So the decision tree predicts that this
  256. 10:08person will not love StatQuest.
  257. 10:11However, this person loves StatQuest, so
  258. 10:15the decision tree made a mistake.
  259. 10:17Wah-wah.
  260. 10:20The second person in the testing data
  261. 10:22liked silly songs.
  262. 10:24And that takes us down the left side of
  263. 10:27the decision tree.
  264. 10:29They were also interested in machine
  265. 10:31learning.
  266. 10:33So we predict that that person loves
  267. 10:35StatQuest.
  268. 10:38And since this person actually loves
  269. 10:40StatQuest, the decision tree did a good
  270. 10:42job.
  271. 10:44Hooray!
  272. 10:46Now we just run all of the other people
  273. 10:48in the testing data down the decision
  274. 10:50tree and compare the predictions to
  275. 10:53reality.
  276. 10:55Then we can compare this decision tree
  277. 10:57to the latest greatest machine learning
  278. 10:59method.
  279. 11:01Ultimately, we pick the method that does
  280. 11:03the best job predicting if someone will
  281. 11:05love StatQuest or not.
  282. 11:09Triple bam!
  283. 11:12In summary,
  284. 11:13machine learning is all about making
  285. 11:16predictions and classifications.
  286. 11:19There are tons of fancy machine learning
  287. 11:21methods, but the most important thing to
  288. 11:23know about them isn't what makes them so
  289. 11:25fancy.
  290. 11:27It's that we decide which method fits
  291. 11:29our needs the best by using testing
  292. 11:31data.
  293. 11:33One last thing before we go.
  294. 11:36You may be wondering how we decide which
  295. 11:38data go into the training set and which
  296. 11:41data go into the testing set.
  297. 11:44Earlier, we just arbitrarily decided
  298. 11:47that these red dots were the training
  299. 11:48data.
  300. 11:50But the blue dots could have just as
  301. 11:53easily been the training data.
  302. 11:56The good news is that there are ways to
  303. 11:58determine which samples should be used
  304. 12:00for training data and which samples
  305. 12:02should be used for testing data.
  306. 12:05And if you're interested in learning
  307. 12:07more about this, check out the
  308. 12:08StatQuest.
  309. 12:10And there are lots more StatQuests that
  310. 12:12walk you through machine learning
  311. 12:14concepts step-by-step, so check them
  312. 12:17out.
  313. 12:19Hooray! We've made it to the end of
  314. 12:21another exciting StatQuest. If you like
  315. 12:24this StatQuest and want to see more,
  316. 12:26please subscribe.
  317. 12:28And if you want to support StatQuest,
  318. 12:29well, consider buying one or two of my
  319. 12:31original songs or getting a t-shirt or a
  320. 12:34hoodie or some other slick merchandise.
  321. 12:37There's links on the screen and there's
  322. 12:39links in the description below. All
  323. 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.