Data & AI · Free course

Machine Learning for Everybody: A Comprehensive Guide

An accessible, hands-on course designed for beginners to learn the core concepts of supervised and unsupervised machine learning. You will build models from scratch using Python, Google Colab, and popular libraries like TensorFlow and Scikit-Learn.

by freeCodeCamp.org · Watch the original on YouTube

  • beginner
  • 29 lessons
  • 3.9 hours of video
  • 9 days at 30 min/day

Loading course start…

What you’ll learn

  • Understand the differences between supervised, unsupervised, and reinforcement learning.
  • Implement classification models including KNN, Naive Bayes, Logistic Regression, and SVM.
  • Build and tune neural networks using TensorFlow.
  • Apply linear regression techniques to predict continuous values.
  • Perform unsupervised learning tasks like K-Means clustering and PCA.

Your daily curriculum

A plan for about 30 minutes a day, including time for notes and questions. Adjust your pace in your own copy.

Day 1 · about 34 min · 0:00 – 27:34

  1. 1. Introduction to Machine Learning and Data Loading

    0:00 – 8:35

    Learn the basics of the machine learning workflow, including how to import datasets and prepare data frames using Pandas.

    • Machine learning is a subdomain of computer science focusing on algorithms that learn from data without explicit programming. 0:00
    • Pandas read_csv is used to turn comma-separated files into data frame objects. 3:55
    • Data cleaning often involves converting categorical labels (like G/H) into numerical values (0/1). 6:17
  2. 2. Machine Learning Fundamentals

    8:35 – 12:29

    Understand the core differences between AI, machine learning, and data science, and define the three main types of learning.

    • AI enables machines to simulate human behavior, while ML is a subset focused on making predictions from data. 9:08
    • Supervised learning uses labeled inputs to train models to predict outputs. 9:39
    • Unsupervised learning uses unlabeled data to find patterns or clusters. 10:47
    • Reinforcement learning involves an agent learning through rewards and penalties. 11:19
  3. 3. Feature Engineering and Data Types

    12:29 – 17:29

    Learn how to prepare different types of features, including one-hot encoding for categorical data and handling numerical data.

    • Qualitative (categorical) data with no inherent order is called nominal data. 13:33
    • One-hot encoding converts categorical variables into binary vectors. 14:06
    • Ordinal data has an inherent order, allowing for numerical ranking. 15:15
    • Quantitative data can be discrete (integers) or continuous (real numbers). 16:22
  4. 4. Classification Tasks: Binary vs. Multi-class

    17:29 – 20:10

    Explore the differences between binary and multi-class classification tasks in supervised learning.

    • Binary classification involves predicting between two categories (e.g., spam vs. not spam). 18:03
    • Multi-class classification involves predicting one of three or more distinct categories. 18:35
    • Regression is used when predicting continuous numerical values rather than discrete classes. 19:06
  5. 5. Model Evaluation and Training

    20:10 – 27:34

    Learn how to split data into training, validation, and testing sets to ensure model generalizability.

    • The feature matrix (X) contains input features, while the target vector (y) contains labels. 21:19
    • Training involves adjusting model parameters to minimize the difference between predictions and actual values. 22:21
    • Data is split into training (for learning), validation (for tuning), and testing (for final assessment). 24:02

Day 2 · about 32 min · 27:34 – 52:45

  1. 6. Understanding Loss Functions

    27:34 – 30:25

    Deep dive into loss functions and how they quantify model performance.

    • Loss represents the difference between the model's prediction and the actual label. 27:34
    • L1 loss uses the absolute value of the difference, while L2 loss uses the square of the difference. 28:10
    • Binary cross-entropy is a common loss function for binary classification. 29:15
  2. 7. Data Visualization and Splitting

    30:25 – 36:20

    Learn how to visualize feature distributions and split datasets programmatically.

    • Histograms help visualize the distribution of features for different classes. 31:00
    • Normalizing distributions (density=True) allows for fair comparison between classes with different sample sizes. 32:43
    • NumPy split can be used to shuffle and divide data into training, validation, and test sets. 35:12
  3. 8. Scaling and Resampling Data

    36:20 – 44:49

    Master data preprocessing techniques like feature scaling and oversampling to handle imbalanced datasets.

    • StandardScaler scales data based on the mean and standard deviation of the column. 37:30
    • H-stack (horizontal stack) combines arrays side-by-side. 38:36
    • RandomOversampler increases the size of the minority class to balance the dataset. 41:23
  4. 9. K-Nearest Neighbors (KNN) Theory

    44:49 – 52:45

    Understand the logic behind the K-Nearest Neighbors algorithm and Euclidean distance.

    • KNN classifies a point based on the majority label of its K nearest neighbors. 47:06
    • Euclidean distance is the straight-line distance between two points in feature space. 47:45
    • Choosing K is a hyperparameter decision; smaller K can be sensitive to noise. 49:25

Day 3 · about 31 min · 52:45 – 1:17:31

  1. 10. Implementing K-Nearest Neighbors

    52:45 – 58:42

    Apply the KNN algorithm using Scikit-Learn and interpret classification reports.

    • KNeighborsClassifier is the standard Scikit-Learn implementation for KNN. 53:20
    • Precision measures the accuracy of positive predictions; recall measures the ability to find all positive instances. 56:33
    • The F1-score provides a balance between precision and recall. 57:35
  2. 11. Naive Bayes Theory (part 1 of 2)

    58:42 – 1:08:07

    Learn the probability foundations of Naive Bayes, including Bayes' Rule and conditional probability.

    • Bayes' Rule allows calculating the probability of an event based on prior knowledge of conditions. 1:02:18
  3. 12. Naive Bayes Theory (part 2 of 2)

    1:08:07 – 1:17:31

    Learn the probability foundations of Naive Bayes, including Bayes' Rule and conditional probability.

    • Naive Bayes assumes all features are independent given the class. 1:12:56
    • MAP (Maximum A Posteriori) estimation picks the class that maximizes the posterior probability. 1:16:21

Day 4 · about 39 min · 1:17:31 – 1:47:55

  1. 13. Naive Bayes Implementation and Logistic Regression Theory

    1:17:31 – 1:27:06

    Implement Gaussian Naive Bayes and explore the mathematical foundations of Logistic Regression.

    • GaussianNB is used for classification when features follow a normal distribution. 1:17:31
    • Logistic regression models the probability of a class using the sigmoid function. 1:24:45
    • The sigmoid function maps any real-valued number into a range between 0 and 1. 1:25:20
  2. 14. Implementing Logistic Regression

    1:27:06 – 1:29:20

    Apply Logistic Regression to classification tasks using Scikit-Learn.

    • LogisticRegression in Scikit-Learn uses an L2 penalty by default. 1:27:43
    • Hyperparameters like penalty and solver can be tuned to improve model performance. 1:28:16
    • Logistic regression is often a strong baseline model for binary classification. 1:28:49
  3. 15. Support Vector Machines (SVM) Theory

    1:29:20 – 1:37:13

    Understand the concept of hyperplanes, margins, and the kernel trick in SVMs.

    • The kernel trick allows SVMs to handle non-linearly separable data by projecting it into higher dimensions. 1:29:20
    • SVMs aim to find the hyperplane that best separates classes with the largest possible margin. 1:33:22
    • Support vectors are the data points that lie on the margin lines and define the boundary. 1:33:57
  4. 16. Implementing Support Vector Machines

    1:37:13 – 1:39:31

    Apply the SVC (Support Vector Classifier) to classification problems.

    • SVMs are generally robust but can be sensitive to outliers. 1:37:13
    • SVC is the Scikit-Learn class for support vector classification. 1:37:49
    • SVMs often provide high accuracy for complex classification tasks. 1:38:23
  5. 17. Neural Networks Theory

    1:39:31 – 1:47:55

    Learn the architecture of neural networks, including neurons, activation functions, and gradient descent.

    • Neural networks consist of input, hidden, and output layers of interconnected neurons. 1:40:03
    • Activation functions (like ReLU or Sigmoid) introduce non-linearity, preventing the model from collapsing into a linear model. 1:42:52
    • Gradient descent is an optimization algorithm used to minimize the loss function by updating weights. 1:44:30
    • The learning rate controls the size of steps taken during gradient descent. 1:46:45

Day 5 · about 28 min · 1:47:55 – 2:10:11

  1. 18. Implementing Neural Networks

    1:47:55 – 1:56:40

    Build and train a neural network using TensorFlow and Keras.

    • TensorFlow's Sequential model allows for stacking layers linearly. 1:49:02
    • Dense layers are fully connected layers where every input is connected to every output. 1:49:34
    • Binary cross-entropy is the standard loss function for binary classification neural networks. 1:52:44
  2. 19. Hyperparameter Tuning

    1:56:40 – 2:10:11

    Learn how to optimize neural network performance through grid search and dropout layers.

    • Grid search involves testing different combinations of hyperparameters to find the best model configuration. 1:57:19
    • Dropout layers randomly turn off nodes during training to prevent overfitting. 1:57:51
    • Validation loss is a key metric for determining the best model during tuning. 2:05:06

Day 6 · about 30 min · 2:10:11 – 2:34:11

  1. 20. Linear Regression Theory

    2:10:11 – 2:22:43

    Understand the mechanics of linear regression, residuals, and the assumptions required for the model.

    • Linear regression models the relationship between variables by fitting a line of best fit. 2:11:21
    • Residuals are the differences between the actual data points and the predicted values on the regression line. 2:12:55
    • Key assumptions include linearity, independence of errors, normality, and homoscedasticity. 2:17:23
  2. 21. Regression Evaluation Metrics

    2:22:43 – 2:34:11

    Learn how to evaluate regression models using MAE, MSE, RMSE, and R-squared.

    • Mean Absolute Error (MAE) provides the average distance between predictions and actual values. 2:22:43
    • Mean Squared Error (MSE) penalizes larger errors more heavily than MAE. 2:26:06
    • Root Mean Squared Error (RMSE) brings the error back to the original units of the target variable. 2:27:53
    • R-squared measures how well the regression model explains the variance in the data. 2:28:30

Day 7 · about 38 min · 2:34:11 – 3:04:09

  1. 22. Bike Sharing Regression Project (part 1 of 2)

    2:34:11 – 2:44:21

    Apply regression techniques to a real-world dataset to predict bike rental counts.

    • Data preprocessing for regression often involves dropping irrelevant columns and handling categorical data. 2:38:44
  2. 23. Bike Sharing Regression Project (part 2 of 2)

    2:44:21 – 2:54:30

    Apply regression techniques to a real-world dataset to predict bike rental counts.

    • Simple linear regression uses one feature to predict the target. 2:48:40
    • Multiple linear regression incorporates multiple features to improve prediction accuracy. 2:52:46
  3. 24. Neural Net Regression (part 1 of 2)

    2:54:30 – 3:04:09

    Implement neural networks for regression tasks and compare them with linear regression models.

    • Normalization layers in TensorFlow help scale input data for neural networks. 2:55:08
    • A single dense layer with one unit and no activation function acts as a linear regressor. 2:56:14

Day 8 · about 36 min · 3:04:09 – 3:33:50

  1. 25. Neural Net Regression (part 2 of 2)

    3:04:09 – 3:12:29

    Implement neural networks for regression tasks and compare them with linear regression models.

    • Neural networks can model non-linear relationships that simple linear regression cannot. 3:04:09
  2. 26. Unsupervised Learning Theory: K-Means and PCA (part 1 of 2)

    3:12:29 – 3:23:57

    Explore unsupervised learning techniques for clustering and dimensionality reduction.

    • K-Means clustering iteratively assigns points to the nearest centroid and updates centroids. 3:13:05
    • Expectation-Maximization is the process of assigning points (E-step) and updating centroids (M-step). 3:22:20
  3. 27. Unsupervised Learning Theory: K-Means and PCA (part 2 of 2)

    3:23:57 – 3:33:50

    Explore unsupervised learning techniques for clustering and dimensionality reduction.

    • Principal Component Analysis (PCA) reduces dimensionality by finding directions with the largest variance. 3:23:57

Day 9 · about 26 min · 3:33:50 – 3:53:53

  1. 28. Unsupervised Learning Project (part 1 of 2)

    3:33:50 – 3:40:40

    Implement K-Means clustering and PCA on a wheat seed dataset to identify patterns without labels.

    • 29. Unsupervised Learning Project (part 2 of 2)

      3:40:40 – 3:53:53

      Implement K-Means clustering and PCA on a wheat seed dataset to identify patterns without labels.

      • K-Means can identify clusters in data without prior knowledge of labels. 3:40:40
      • PCA can reduce high-dimensional data into 2D or 3D for easier visualization. 3:48:16
      • Unsupervised learning can reveal hidden structures and groupings within datasets. 3:52:45

    This course is built from a free YouTube video by freeCodeCamp.org. The videos play on YouTube, and the lessons, summaries and quizzes are Notelify’s own study notes. Notelify isn’t affiliated with YouTube or the creator. Creators can ask us to remove a course at support@notelifyapp.com.