Skip to course content
Free course

Machine Learning Foundations / Module 2

Module 2 lesson

Sampling, Missingness, and Imbalance

Unit ID: ML-M02-U03 Estimated active time: 25-35 minutes

A small dataset can mislead

The Module 2 dataset has only 24 rows. That is fine for learning, but it is not enough for real conclusions.

Before modelling, ask:

  • Who is included?
  • Who is missing?
  • Which values are blank?
  • Is one target class much more common than another?

Missingness

A missing value is not just an empty cell. It is a question.

Why is it missing?

In this dataset, day3_minutes_active is missing for some rows because the activity timer did not record a value. final_quiz_score is missing for learners who did not complete the module.

These are different kinds of missingness.

Imbalance

Target imbalance happens when one outcome is much more common than another.

If 95 percent of rows have target 0, a model can look accurate by predicting 0 almost always. That may be useless.

In this dataset, the imbalance is small, but learners should still count the target values.

Sampling and coverage

Sampling asks whether the rows represent the situation where the model will be used.

For example:

  • Are all cohorts included?
  • Are self-paced and team-training learners both included?
  • Did the course change after these records were collected?
  • Are low-connectivity learners under-recorded?

These questions affect whether results may generalise.

Practice

Use pandas to calculate:

df.isna().sum()
df["completed_module1_by_day10"].value_counts()
df["learner_segment"].value_counts()

Write one missingness note and one coverage note.

Takeaway

Missingness, imbalance, and coverage are not cleanup chores. They affect what a model can learn and whose experience may be represented.