1. Home
  2. Explore
  3. Computer Science
  4. Machine Learning Foundations

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Machine Learning Foundations

Speaker 1Speaker 2

Machine Learning Foundations

18:19
0:00-18:19
  1. Corey

    Welcome to The Explainer. Today we’re building a foundation across four units of machine learning: what it is, how data is prepared, how supervised models learn, and how clustering, ensembles, and evaluation fit into the process. The central idea is that a machine can learn patterns from experience rather than relying on a person to spell out every rule.

  2. Maria

    That difference matters because traditional programming starts with data and rules written by a programmer, then produces an output. In machine learning, we provide examples—and often the desired outputs—and the algorithm learns a program, or a set of rules, from them. That makes it useful for problems where writing every possible rule by hand would be impractical.

  3. Corey

    A classic definition puts learning in terms of three pieces: experience, E; a task, T; and a performance measure, P. A program is learning when its performance on task T, measured by P, improves with experience E. For a driving robot, the task might be driving on highways using vision sensors, performance might be distance traveled before a mistake, and experience could be recorded images and steering actions from human driving.

  4. Maria

    So the robot isn’t being given a complete list of driving rules. Instead, it uses experience to improve at the task, and we measure whether it’s improving. That gives us a practical test for whether learning is happening: identify the task, decide what success means, and provide experience that can help the system get better.

  5. Corey

    More generally, machine learning is a branch of artificial intelligence that lets algorithms find patterns in data and use them to make predictions about new, similar data. A spreadsheet with thousands of rows may overwhelm a person trying to spot relationships, but an algorithm can analyze those rows systematically and identify correlations that aren’t obvious at a glance.

  6. Maria

    Think of identifying cakes in photographs. With conventional programming, you might write rules about shape or color—but a square cake or a vanilla cake could break those rules. With machine learning, you can provide many examples of different cakes and let the algorithm learn patterns that distinguish them. It can then use those learned patterns on images it hasn’t seen before.

  7. Corey

    That approach connects to several useful capabilities. Machine learning can learn from labeled examples, adapt as new data arrives, and work with large volumes of information. It can also automate repetitive tasks, personalize recommendations, and help investigate complex problems. Spam filters, streaming recommendations, customer-service chatbots, and medical-image analysis are all examples discussed in this material.

  8. Maria

    Those applications don’t mean machine learning is automatically right or that it replaces human judgment. The point is that it can find and process patterns at a scale that would be difficult to handle manually. To understand how it learns, we need to distinguish three major approaches: supervised learning, unsupervised learning, and reinforcement learning.

  9. Corey

    Supervised learning uses labeled data: examples that include the correct answer. Unsupervised learning works with unlabeled data and looks for structure without an answer key. Reinforcement learning is different from both: an agent interacts with an environment, takes actions, and learns from rewards or penalties.

  10. Maria

    In supervised learning, the algorithm is like a student working with flashcards. It predicts an answer, compares that prediction with the known answer, and adjusts when it is wrong. For example, a clinic dataset might include patient age and gender along with a healthy-or-sick label. After learning from those examples, the model can predict a label for a new patient.

  11. Corey

    Unsupervised learning has no teacher providing those labels. Give it patient ages, genders, and test results without telling it who is sick, and it can look for clusters or associations in the data. It might reveal groups that warrant investigation, but the groupings themselves don’t automatically tell us what they mean; people still need to interpret them.

  12. Maria

    Reinforcement learning is about choosing actions to maximize rewards. The learner discovers which actions work rather than being handed a fixed set of correct actions. Rewards can be delayed: in chess, a move may seem to have no immediate benefit but help set up a win many moves later. That makes this approach relevant to complex games and to teaching robots to move and balance.

  13. Corey

    Before a model can make useful predictions, a project needs a workflow. It begins with data, which may be structured, like a spreadsheet, or unstructured, like text and images. Then the data is processed: we clean it, handle missing values, and standardize formats. Poor-quality input can lead to poor-quality predictions.

  14. Maria

    Next comes choosing useful features and selecting an algorithm. Features are the inputs the model uses. If we’re predicting heart-disease risk, age and blood pressure may be relevant, while hair color may not be. Removing irrelevant information can reduce dimensionality and keep noise from distracting the model.

  15. Corey

    Then we train the model and evaluate it using test data. If performance isn’t adequate, we revisit choices and adjust the model. Hyperparameter tuning is part of that iterative process: hyperparameters are settings we choose to influence training. Like adjusting an oven after a cake turns out too dry, we tune settings and try again before deploying a model to make predictions on new data.

  16. Maria

    It also helps to place machine learning within the wider technology landscape. Artificial intelligence is the broad field of making computers perform intelligent tasks. Machine learning is an approach within AI that learns from data, and deep learning is a specialized part of machine learning that uses layered neural networks. Data science is the broader practice of extracting knowledge from data, and it intersects with machine learning.

  17. Corey

    Now let’s turn to Unit 2: getting data into a form models can use. A dataset with hundreds or thousands of features can create the curse of dimensionality. As the number of dimensions grows, the space expands dramatically and data becomes sparse. Training can become slower, and models can have difficulty finding meaningful patterns.

  18. Maria

    Dimensionality reduction transforms high-dimensional data into a lower-dimensional representation while trying to preserve its important information. It’s like packing for a trip: you can’t bring your entire closet, so you choose a smaller set of useful items that captures what you need. The aim isn’t to discard information carelessly, but to make the data more compact without losing its essential structure.

  19. Corey

    A dataset can be viewed as a matrix, a structured grid of values. Each row vector represents one instance, such as one patient’s record. Each column vector represents one feature across instances, such as the ages of all the patients. This organization lets algorithms compare features or find similarities among records.

  20. Maria

    Preprocessing commonly includes three stages. First, data cleaning: handle missing values, reduce noise, and address extreme outliers. For instance, one option for a missing age is to fill it with the average age, rather than discarding the whole record. Second, transform the data, which can include normalization or standardization. Third, reduce the data’s size or number of dimensions when appropriate.

  21. Corey

    Scaling matters because features can use very different numerical ranges. In a housing dataset, bedrooms might range from one to five, while square footage ranges from one thousand to five thousand. Without scaling, some algorithms may be overly influenced by the feature with the larger numbers. Standardization often puts features on a comparable scale, commonly with a mean of zero and a standard deviation of one.

  22. Maria

    There are two distinct strategies for reducing the feature set. Feature selection keeps a subset of the original features and discards the rest. Feature extraction combines or transforms original information into a new set of features that may be more compact. Selection keeps recognizable columns; extraction creates new representations.

  23. Corey

    Feature selection can proceed forward or backward. Forward selection starts with no features, then adds the feature that helps most at each step, stopping when additions no longer help. Backward selection starts with all the features and removes the least useful one at a time, stopping when further removal would hurt performance.

  24. Maria

    A major feature-extraction method is principal component analysis, or PCA. Picture data points forming a cloud. PCA finds new axes that capture as much variance—or spread—as possible. The first principal component follows the direction of greatest variation; the next is at a right angle to the first and captures the next greatest variation. These new axes are the principal components.

  25. Corey

    Why prioritize variance? A feature that never changes—for example, if every patient were exactly the same age—would provide no variation to help distinguish cases. PCA can reduce many original dimensions to a smaller number of components while retaining much of the data’s variation. This can compress data, speed processing, help reduce noise, and make high-dimensional data easier to visualize in two or three dimensions.

  26. Maria

    PCA also replaces correlated original features with orthogonal components, which can help address multicollinearity. But there are trade-offs. The components can be difficult to interpret because each is a mathematical combination of original features. PCA is sensitive to scaling, assumes linear relationships, and can lose important information if too few components are retained. That’s why standardizing first and choosing the number of components carefully matter.

  27. Corey

    Unit 3 focuses on supervised learning in more depth. The model learns a function mapping inputs to outputs from labeled input-output pairs. The inputs are features; the known answers are target outputs. During training, predictions are compared with those answers, and the model adjusts its internal parameters to improve.

  28. Maria

    A typical supervised project follows six steps: collect labeled data; preprocess it; select a suitable model; train it using the examples; evaluate it on unseen data; and use the trained model to make predictions. Testing on unseen examples is essential, because a model that performs well on its training data may have memorized those examples instead of learning a pattern that generalizes.

  29. Corey

    The first decision about the task is whether you’re predicting a category or an amount. Predicting categories is classification: spam or not spam, healthy or sick. Predicting a continuous value is regression: a house price, sales revenue, or a blood-pressure measurement. The kind of output you need helps determine which algorithm to use.

  30. Maria

    Linear regression is used for continuous outputs. It fits a linear equation to represent the relationship between a dependent variable—the value we want to predict—and one or more independent features. With one input feature, such as square footage, it’s simple linear regression. With several features, such as bedrooms and house age as well, it’s multiple linear regression.

  31. Corey

    Logistic regression has a confusing name because it is used for classification. It estimates the probability that an example belongs to a category. It can handle binary outcomes, such as success or failure; multinomial outcomes, with three or more unordered categories such as cat, dog, or bird; and ordinal outcomes, where categories have a meaningful order, such as poor, good, or excellent.

  32. Maria

    Decision trees can handle classification and regression. They work like flowcharts: a root node asks a question, branches represent possible answers, and later nodes ask further questions. The process continues until a leaf node gives the final prediction. That step-by-step structure makes a tree’s decision process intuitive to follow.

  33. Corey

    Support vector machines, or SVMs, are commonly introduced for binary classification. They seek a decision boundary, called a hyperplane, that separates the classes. The points nearest that boundary are the support vectors. SVMs aim to maximize the margin—the distance between the boundary and those closest points—which can help the model generalize to new data.

  34. Maria

    A hard margin requires a strict separation, which can be vulnerable to an outlier in messy real-world data. A soft margin allows some points to fall on the wrong side or within the margin. That flexibility can produce a more robust boundary when perfect separation isn’t realistic.

  35. Corey

    Unit 4 brings together three more pieces of the machine-learning lifecycle: clustering unlabeled data, combining models, and measuring performance. Let’s begin with k-means clustering. Unlike supervised learning, it has no answer key; the goal is to find structure in the data based on similarities.

  36. Maria

    K-means groups data points into K clusters, where K is a number chosen by the person using the method. It starts by placing K centroids, or proposed cluster centers, then assigns each data point to its nearest centroid. Next it recalculates the center of each group and moves the centroid there. Because the centers moved, some points may change groups, so the assignment and update steps repeat.

  37. Corey

    The process stops when the centroids and assignments settle—when the centers no longer move and points no longer switch clusters. For example, customer ages and incomes might be grouped into clusters without labels telling the algorithm who is a premium customer. K-means finds groups by distance, but interpreting what those groups represent takes further analysis.

  38. Maria

    Ensemble methods take a different approach: they combine predictions from multiple models to improve accuracy or robustness compared with relying on one model. You can think of asking a crowd to estimate something. One person’s answer might be far off, while combining many answers can yield a stronger result. Ensembles can also reduce the risk of depending on one overly complex model.

  39. Corey

    Boosting is an ensemble technique that builds models sequentially. It starts with a model that makes some errors, identifies the cases it got wrong, and gives a later model extra emphasis on those difficult cases. Each subsequent model focuses on errors made earlier. The chain continues until the chosen stopping condition—such as a set number of models—is reached.

  40. Maria

    That error-focused process can turn weak learners into a stronger predictive system. But there’s a caution: focusing too hard on every training error can lead to overfitting. A model might fit the training data extremely well yet perform poorly in a new environment. That’s one reason to evaluate on unseen data rather than assume training performance tells the whole story.

  41. Corey

    Evaluation uses several kinds of measures, because no single score tells the entire story. Accuracy is the proportion of predictions that are correct. A confusion matrix lays out types of correct and incorrect classifications, including false positives and false negatives. From it, we can calculate precision, recall, and the F1 score, which combines precision and recall.

  42. Maria

    ROC curves and the area under the curve, or AUC, offer additional ways to assess classification performance. Looking at the distribution of errors also matters. Different metrics reveal different strengths and weaknesses, so choosing and interpreting them depends on what we need to understand about the model.

  43. Corey

    One measure of spread covered here is mean absolute deviation, or MAD. It describes the average distance of observations from their mean. In the formula, X is an individual observation, mu is the mean, and N is the number of observations. For each value, take the absolute difference between X and mu, add those differences, and divide by N.

  44. Maria

    The absolute value means a point five units above the mean and one five units below it both count as a distance of five; the direction doesn’t matter. A high MAD indicates values are more spread out around the mean, while a low MAD indicates they’re more tightly grouped. The same idea can help describe how spread out a set of errors is.

  45. Corey

    So the big picture across these four units is a sequence of connected choices. We define what learning means, prepare and represent the data, select a learning approach and model, train and evaluate it, and then use it to make predictions or find structure. Data preparation and evaluation aren’t side issues—they’re central to building a useful system.

  46. Maria

    And each learning approach answers a different kind of question: supervised learning learns from examples with known answers; unsupervised learning searches unlabeled data for structure; and reinforcement learning improves actions through rewards and penalties. Regression predicts amounts, classification predicts categories, clustering finds groups, and ensembles combine models.

  47. Corey

    The key caution is to distinguish learning from memorization. A model can look successful on examples it has already seen and still fail on new ones. Testing, thoughtful data preparation, appropriate metrics, and careful model choices help us judge whether it has learned a pattern that is useful beyond the training data.

  48. Maria

    That’s our foundation: machine learning learns patterns from experience, but the quality of its results depends on the data, the method, and how carefully we evaluate it. As we go deeper into the mathematical details of supervised algorithms, keep asking two questions: what is the model learning from, and how will we know whether it works on data it hasn’t seen?

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent