
Formulate a model template, such as y = r^x, learn from data, and train to minimize error by selecting the best supervised model through a data-driven learning process.
Explain that a machine learning model combines a human defined template with parameter fitting from data, guided by problem assumptions like exponential growth, with deep learning following the same pattern.
Fit a model to data to forecast future epidemic evolution beyond observed data. Emphasize extrapolation with trust in the exponential assumptions to guide decisions such as interventions or recommendations.
AlphaZero learns move value from simulated games using a human-designed template, showing that human-encoded template assumptions drive performance.
Understand overfitting and underfitting, where memorizing training data causes high variance or bias and hurts unseen-data performance; balance with more data, suitable model complexity, and regularization.
Uncover why to use machine learning: automate parameter search for complex models, let data drive decisions, and reveal new insights you’d miss, with examples from recommendations and image analysis.
Summary notes of this lecture.
Explore linear regression for predicting continuous insurance claims in a real-world Insure Me scenario. Learn how X features map to Y claims through training on historical data.
Learn how supervised learning uses true labeled data during training to predict claims from client features, and how inference uses the trained model to estimate future claims quickly.
Master the machine learning recipe: define a template with learnable parameters, measure error with a loss, and train to minimize it in linear regression, with inputs like rooms and age.
Explore linear, nonlinear, and proportional relations with real-world examples—car rental thresholds, tax structures, and commissions—and connect these to linear regression concepts and the intercept.
Revisit the linear regression model template, showing y hat equals b plus sum of w i x i and the dot product of W and X for x1 through x5.
Compare mean absolute error and mean squared error as loss functions. Understand how the choice affects model training and evaluation for regression tasks.
Code time trains a linear regression on a Kaggle dataset using a notebook and Pandas, selecting X and Y, then assesses mean squared error against a naive baseline.
Explore when to use a linear model by weighing assumptions, opportunities for insights from coefficients, and the value of explainability, while noting limits and where transformations may help.
Examine scaling in machine learning pipelines to align input variable scales, enabling meaningful comparison of coefficients in linear regression and improving model performance by transforming data to similar units.
Min-max scaling maps data to the 0–1 range by subtracting the minimum and dividing by the range. For example, a size of 1000–4500 becomes 0–1.
Explore min-max scaling with pandas to scale each feature independently, train a linear regression on the scaled data, and compare outcomes with mean squared error.
Assess the problems of min-max scaling, notably its distortion by outliers and keeping targets unscaled, then consider alternative input scaling approaches for better interpretation.
Explore how the IQ concept scales data by measuring dispersion with mean deviation and standard deviation, and applying this unit to scale variables in machine learning.
Compare coefficients before and after scaling to see how scaling alters magnitudes and the intercept in claims prediction. Scaled zero equals average inputs, making the intercept reflect a typical client.
During inference, scale new inputs with the training data's mean and standard deviation, not row-specific values, and remember these statistics to ensure consistent predictions.
Apply L2 regularization to penalize large weights via the alpha hyperparameter. Scale features with standard scaling so weights are comparable, while the intercept remains unregularized.
Drive L1 regularized linear regression with varying alphas to zero out some features, discarding phone numbers and house size, while validation seeks a sweet spot to balance error and overfitting.
L2 regularization keeps a bowl shape, minimum moves left as alpha increases; L1 adds absolute value, creates a corner, can drive minimum to zero, thus encouraging zeros.
Learn why evaluating models on training data misleads about performance, and use held-out data to compare regularized and unregularized models, guarding against overfitting and improving generalization.
Split data into training, validation, and test sets; train a pipeline on the training data, scale with the training mean and std, and assess out-of-sample generalization on the validation set.
Use the validation set to perform hyperparameter tuning across model templates, comparing L1 and L2 regularization with different alphas via grid search, to select the best model and estimate generalization.
Explore why model selection is problematic when we pick the best model after validation on unseen data; grid search across alphas and L1/L2 models can mislead us.
Recognize that model selection is biased and cherry-picking models can yield luck-based performance, while repeated use of the validation set taints data and biases out-of-sample estimates.
Demonstrate how validation challenges arise in machine learning when selecting among many models. Show that models seek true forces that explain the target and that selection can taint the results.
The lecturer shares an anecdote about building a satellite image dataset to predict building footprints, revealing how an open-ended leaderboard encouraged submissions, leakage from training data, and tainted validation results.
Show how the test set yields a binary verdict after training on the training set and validating with alphas, avoiding monkey-typewriter pitfalls, ensuring unseen data and predefined acceptance criteria.
Design experiments in advance and split data into training and validation sets to minimize being fooled by randomness, guided by the no free lunch theorem and cross-validation to estimate performance.
Use cross-validation with multiple folds (typically five or ten) to train models in Python and average results to reduce variance. Reserve a test set at the end for model selection.
Assess five models with cross-validation across folds, note similar scores within rows, and identify ten-fold cross-validation as the sweet spot, keeping the test set unused.
Explore AutoML with h2o, which automates model selection by trying multiple templates, ensembles, and fivefold cross-validated performance, and even generates new features by multiplying feature pairs.
AutoML can produce useful models but depends on human assumptions and careful feature design; cross-validation can mislead, and features like phone number times age may degrade performance on test set.
Identify common mistakes that escape the validation process by properly splitting data into training, validation, and test sets, and recognize that random splits resemble exams.
Explain data leakage where a model uses information it should not see, such as item count predicting order price, which cheats validation and breaches the golden rule of validation.
Apply the golden rule by validating models for real-life use, not only their accuracy. Detect data leakage and remove future-looking features to ensure the model can be used in production.
Use feature importance after training to spot data leakage and assess if the model relies on suspicious inputs, like basket size, via linear model coefficients.
Present a real data leakage example by predicting if a client will answer the door, using features like age, days in advance booked, and one-hot encoded client type for classification.
Highlight how data leakage creates perfect accuracy by using a feature whose digit count varies with the target class, revealing the model memorized a spurious rule.
Avoid random splits of dependent data to prevent leakage from correlated animal pictures into training and validation, avoiding overfitting by splitting data by animal.
Identify look-ahead bias as a common pitfall where future information leaks into predictions. Avoid aggregated time-series features that reveal November prices early, which cheats the model’s training and deployment.
Explore two look-ahead bias solutions: using the previous year's monthly average to capture seasonality, and applying a 30-day rolling average before the purchase date.
Avoid look-ahead bias by using chronological training, validation, and test splits. Random splits can cause overfitting by memorizing rare events, like a bankrupt airline, in all sets.
Master temporally aware cross-validation for time-series data by training on prior periods and validating on later months with rolling or sliding windows, for robust model selection and tuning.
Learn how predicting purchases does not prove a model understands price sensitivity, and why causal inference and counterfactuals require separate validation before using a model for new tasks.
See why black box and AutoML can mislead when data leakage and misleading features occur. Build your career by prioritizing validation and solid fundamentals over shortcuts in machine learning.
Classify images of handwritten digits using a pixel-based representation by flattening 28x28 grayscale images into rows of 784 pixel values, trained on the Amnesty dataset (60,000 training, 10,000 test).
Extend regression to binary classification with a logistic model, using a weighted sum of pixel values and an intercept, then apply a sigmoid to output the cat-versus-dog probability.
Learn why binary classification uses a single output and deduces the other class, while multiclass requires K outputs and a self max function to combine probabilities.
Learn how to formulate a multiclass loss using maximum likelihood estimation, building on logistic templates and softmax, as the second step in the three part machine learning recipe.
Learn to compute and maximize the likelihood of the true labels in a digit dataset by multiplying per-row probabilities under independence, using one-hot encoding and maximum likelihood estimation.
Maximize the log likelihood by transforming products into sums for numerical stability, then minimize the negative log likelihood or cross entropy as the loss function.
Analyze negative log-likelihood across scenarios from an unsure model (0.25 per class) to confidently wrong and perfectly right predictions; note infinity for total wrongness and zero for perfect rightness.
Understand binary cross-entropy loss for a two-class logistic model by expanding the loss into terms with y hat and 1 minus y hat, standard in neural networks.
In logistic model, there is no closed form solution to obtain optimal parameters; instead evaluate the cross entropy loss for parameter sets with a trial and error approach.
Explore a naive approach that tests many parameter values for an 8000-parameter image classifier, illustrating why exhaustive search is impractical due to astronomical combinations and slow processing.
Navigate a foggy terrain to minimize the loss function using gradient descent: start from a random parameter point, move along the steepest descent, and repeat until reaching a valley.
Visualize gradient descent as moving through a topographic loss map, taking short steps in the direction of steepest descent until the surface looks flat, reaching the valley.
Learn to compute the gradient of the loss as a vector of partial derivatives across all model parameters, guiding the fastest ascent or descent toward optimal weights and biases.
Explore analytical solutions for gradient calculation by deriving the loss derivative with respect to weights, revealing a simple average over the data set expression for parameter updates.
Compute derivative of the loss with respect to weights using input features and outputs, showing how increasing weights affects loss, averaged over rows to yield gradient vector for gradient descent.
Explore binary classification concepts, identify the positive and negative classes, interpret y hat probabilities, and examine class imbalance with fraud detection datasets.
Measure accuracy as the proportion of correctly classified instances and examine the confusion matrix to compare naive zero-output and logistic models with a 0.5 threshold under class imbalance.
Explore how adjusting the fraud-detection threshold affects true positives and false positives, showing why accuracy fails for imbalanced classes and why businesses may prioritize the positive class.
Analyze precision and recall within a fraud detection scenario, explaining true positives, false positives, false negatives, and true negatives, and how thresholds affect the recall-precision trade-off.
Explore sensitivity and specificity in binary classification, including how many positives and negatives are correctly identified, and the tradeoff with recall, precision, and thresholds.
Explore how roc curves assess classifier performance across thresholds, plotting sensitivity versus one minus specificity, and relate this to precision and recall across many thresholds.
Explore designing a custom business metric to maximize recall on imbalanced data, set thresholds for 90% recall of fraudulent transactions, and compare logistic and gradient boosted trees for precision gains.
Learn to use custom metrics for model evaluation, balancing precision and recall, and applying precision at top 100 to meet business goals, rather than defaulting to the F measure.
This course will teach you the foundations of machine learning. The content was especially designed to help you pass machine learning interviews for data science jobs.
The course will help you:
Pass job interviews and technical quizzes
Avoid rookie mistakes that waste companies' time and money
Be prepared for real work.
Important stuff about this course:
You won't spend hours learning stuff that never comes up in a job interview.
Total beginners are welcome; coding experience or advanced math knowledge are not required.
It was designed by an industry expert who's been on the hiring side of the table and knows what companies are looking for.
This course will be of great help if you are:
A student who wants to prepare for work in data science after graduating.
An established professional or academic who wants to switch careers to data science.
A total beginner who wants to dabble in machine learning and data science for the first time.
How is this different from an academic course or a bootcamp?
In academic courses, your teacher spends hours speaking about calculus and linear algebra, but then none of that comes up in a job interview! That in-depth knowledge certainly has a place but is not what most companies are looking for.
In bootcamps you tend to learn how to use many tools but not how they work under the hood. This black-box knowledge is what companies want to avoid the most in applicants!
This course sits in between—you gain foundational knowledge and truly understand machine learning, without spending time on unimportant stuff.