Introduction to Machine Learning with scikit-learn

Introduction to Machine Learning (scikit-learn) is an intermediate-level course of 5 lessons (about 2 h 20 min), with 13 exercises and 15 quiz questions. Prerequisites: Data Analysis with pandas and NumPy, Probability and Inferential Statistics. Exercises run in the browser, with nothing to install.

  • Data science
  • Intermediate
  • 5 lessons
  • 2 h 20 min
  • 13 exercises
  • Exercises run in the browser

The course in brief

This course lays the foundations of machine learning in Python with scikit-learn. You learn to formulate a problem (features, target, type of learning), to train and evaluate your first models without making mistakes, then to automate preprocessing with pipelines and cross-validation. It prepares you for the courses on supervised learning, unsupervised learning, and model evaluation.

What you will be able to do

  • Formulate a machine learning problem: features, target, supervised or not, regression or classification
  • Train, use, and evaluate a scikit-learn model with fit, predict, and score
  • Split data into training and test sets and diagnose overfitting
  • Scale data without data leakage
  • Build a pipeline and compare models with cross-validation

Syllabus: 5 lessons

  1. 01

    What Is Machine Learning?

    15 minFree preview
    • Distinguish supervised from unsupervised learning
    • Identify the features (X) and the target (y) in a dataset
    • Recognize a regression problem and a classification problem

    Machine learningFeatures and target variableTypes of learning

  2. 02

    The Estimator API: fit, predict, score

    15 min
    • Instantiate, train, and use a scikit-learn estimator
    • Make predictions on new data
    • Measure accuracy with score

    Estimatorfit / predict / scoreHyperparameter

  3. 03

    Splitting Training and Test Data

    15 min
    • Split a dataset with train_test_split
    • Recognize overfitting by comparing training and test scores
    • Use stratify to preserve class proportions

    Train/test splitOverfittingGeneralization

  4. 04

    Preprocessing: Scaling the Data

    15 min
    • Understand why some models are sensitive to feature scale
    • Use StandardScaler and MinMaxScaler
    • Apply fit on the training set only and transform on the test set

    scikit-learn transformerStandardizationData leakage

  5. 05

    Pipelines and Your First Complete Workflow

    20 min
    • Chain preprocessing and a model in a Pipeline
    • Estimate performance with cross_val_score
    • Carry out a complete end-to-end workflow

    PipelineCross-validationModeling workflow

Final project

First diagnostic model: from dataset to final score

Using scikit-learn's built-in load_breast_cancer dataset, build a model that predicts whether a tumor is malignant or benign. You must formulate the problem, split the data cleanly, compare at least three pipelines (for example standardized kNN, standardized logistic regression, decision tree) by cross-validation on the training set, select the best one, and report its performance on the test set, evaluated only once.

Deliverables

  • A reproducible Python notebook or script (fixed random_state values) that goes from loading the data to the test score
  • A table comparing the candidates: mean and standard deviation of the cross-validation scores
  • A short paragraph justifying the choice of model and commenting on the gap between cross-validation score and test score

Assessment criteria

  • Problem correctly formulated (features, target, type of task)
  • Test set isolated and used only once
  • Preprocessing included in pipelines, with no data leakage
  • Models compared by cross-validation, with mean and spread reported
  • Readable, commented, and reproducible code

Frequently asked questions

Do I need to be good at math to follow this course?

No. A grounding in descriptive statistics is enough (mean, standard deviation, proportions). The course favors intuition and practice with scikit-learn; the mathematical details of the models are introduced gradually in the following courses.

What Python prerequisites are needed?

You should be comfortable with Python basics and with handling arrays with numpy and pandas. The course builds on the Python and statistics courses of the Data scientist track.

Why learn machine learning with scikit-learn?

scikit-learn is the reference library for classical machine learning in Python: uniform API, rich documentation, large community. The habits you pick up (pipelines, cross-validation) carry over to other tools.

Does the course include hands-on exercises?

Yes. Each lesson offers code exercises run directly in the browser, with automatic tests, as well as a quiz. A final project has you carry out a complete end-to-end workflow.

This course, told for your job

Say what you want to be able to do: “Introduction to Machine Learning (scikit-learn)” takes its place in your path, with examples from your field. The concepts stay those of the course.

The preview is free, and you can take the courses one at a time without paying. The path only contains lessons from the catalogue.