Part II — Understanding the problem and the data · Chapter 4

Data Understanding

~32 min read5 interactive widgets4 plates

In this chapter

  1. The four steps of the phase
  2. Data collection (or acquisition)
  3. Biases
  4. Biases and fairness
  5. Is data the new oil? The one in ten rule
  6. Where data comes from: public datasets vs new acquisition
  7. Describe the data: profiling Iris
  8. The box plot and the five-number summary
  9. Explore the data
  10. Verify data quality
  11. Check your understanding

1. The four steps of the phase

The data understanding phase of CRISP-DM involves taking a closer look at the data available for mining. The deck states its purpose in one sentence: this step is critical in preventing problems during data preparation, which is typically the longest part of a project. Since preparation eats 50 to 70 percent of the effort (Chapter 2), an hour spent here is worth several later.

The phase involves four steps:

  1. Collection of initial data
  2. Description of data
  3. Exploration of data
  4. Verification of data quality
DATA UNDERSTANDING, STEP BY STEP 1. COLLECT where does it come from, and at what cost? report problems and solutions for replication 2. DESCRIBE does the data satisfy the requirements? format, quantity, records, fields, identities 3. EXPLORE what does it look like against the target? querying, visualization, exploration report 4. VERIFY can we trust it? missing values, coverage, plausibility, synonyms, spelling a quality problem sends you back to collection: collect a different dataset industry standard: this whole phase is 20 to 30 percent of the project
Plate 4.1 — The loop of the phase. Verification is not the end of a pipeline: discovering that age does not cover the whole range, or that a field is 15% missing, sends you back to the first step — before, not after, the expensive preparation work.

Widget — walk the four steps

2. Data collection (or acquisition)

Data collection is the process of gathering information on targeted variables in an established system. The goal is to capture evidence that allows data analysis to formulate credible answers to the questions that have been posed.

The analyst then proceeds to:

Editor's note

"Report problems and solutions to aid with future replications" is the same reproducibility concern that returns twice more in this course: as the random_state seed in Chapter 8, and as the reason universities release their datasets publicly. If nobody can rerun your collection, nobody can check your result.

3. Biases

The deck opens this block with a picture and a question: red dots stand for places where surviving planes were shot. How would you reinforce the planes?

WHERE THE SURVIVING PLANES WERE SHOT cockpit: no marks engines: no marks the sample contains only the planes that came back reinforce where there are NO dots
Plate 4.2 — The survivorship bias, drawn. Every hit mark is evidence of damage a plane survived. The blank areas are not safe: they are the places where a hit meant the plane never made it into the dataset.

What a bias is

The deck gives two definitions:

The catalogue

During data collection and analysis, several biases can occur:

BiasDefinition from the deck
SelectionThe sample used for data collection is not representative of the population being studied
SamplingCertain segments of the population are more likely to be included or excluded from the sample
ResponseParticipants in a survey or study provide inaccurate or misleading responses
ConfirmationThe tendency to favor information that confirms pre-existing beliefs or hypotheses while ignoring contradictory evidence
CulturalData collection methods, survey questions or study designs are culturally insensitive or fail to account for cultural differences
Time-IntervalThe timing of data collection influences the results
… and many others

Quoted on the slide, from Ronald H. Coase: "If you torture the data long enough, it will confess to anything." The deck pairs it with a 2023 Italian press case about data "tortured" to support a political position.

The everyday version: a person who believes in a specific political ideology might seek out news articles or social media posts that reinforce their beliefs, while ignoring or dismissing information that contradicts their views. This selective exposure strengthens the pre-existing opinion.

The "survivors" get studied, while the failures are excluded, leading to potentially flawed conclusions. Three examples from the deck:

  • Start-up success stories: people hear about Apple, Amazon or Tesla and assume hard work and a good idea are enough. This overlooks the countless failed start-ups that had hard-working teams and great ideas but did not survive due to market conditions, competition, or other factors.
  • Fitness and weight loss programs: testimonials highlight people who achieved dramatic results, ignoring the many who followed the same program without noticeable results, due to genetics, lifestyle or other factors.
  • Investment portfolios: financial advice highlights top-performing stocks or funds, focusing on the market "survivors" and ignoring investments that failed or underperformed — which overestimates the likelihood of similar success in the future.

When shopping for a new car, a person may see a car priced at $30,000, and then a second one priced at $25,000. Even if the second car is not objectively better or a great deal, the first price "anchors" the perception of value, leading them to think it is a better deal simply because it is cheaper than the first option.

After watching several news reports about airplane crashes, a person might overestimate the risk of flying and avoid it — despite it being statistically safer than driving — because the images and stories of crashes are more readily available in their memory.

Widget — name the bias

Each scenario is one of the biases catalogued above. Pick the one that fits.

4. Biases and fairness

Fairness refers to the various attempts to correct algorithmic bias in automated decision processes based on ML models. Decisions made by such models after a learning process may be considered unfair if they were based on variables considered sensitive — e.g. gender, ethnicity, sexual orientation, or disability.

Two real cases are put on the table, and the class is asked how could we approach this problem?:

Careful

Both cases are downstream symptoms of upstream data decisions. A recruiting model trained on a decade of hiring outcomes inherits whatever selection bias produced those outcomes — the model is not wrong about the data, the data is a record of the bias. This is why the phase that catches it is data understanding, not evaluation. Chapter 5 continues the thread with the legal side: the GDPR list of sensitive personal data and the risk classes of the AI Act.

5. Is data the new oil? The one in ten rule

The more data we have, the more analysis we can do — however, more data != smarter data. Several disciplines focus on data (Data Science, Data Mining, Big Data, Business Intelligence). In Europe, and now in many areas of the world, there can be problems related to privacy: when is it "right" to protect privacy, and when does it become a limit?

Acquiring data is a time-consuming, investment- and knowledge-intensive process. So: how much data is enough?

For the exam — the one in ten rule

Quoted from Chowdhury and Turin (2020): there is no set rule as to the number of variables to include in a prediction model, as it often depends on several factors. The one in ten rule, a rule that stipulates how many variables/parameters can be estimated from a data set, is quite popular in traditional clinical prediction modeling strategies (e.g., logistic regression and survival models). According to this rule, one variable can be considered in a model for every 10 events.

Apply it backwards to the brown spot case of Chapter 2: 100 attributes would call for on the order of 1000 events, and the project had 100 rows. The rule would have killed the collection design on paper, before an employee spent months driving across Emilia-Romagna.

6. Where data comes from: public datasets vs new acquisition

Acquiring a new dataset

Data collection is usually a costly process: an investment of time and money for

It is therefore necessary to carefully consider whether it is appropriate to acquire a new dataset: the considerations are not only engineering but also management and economic, and future needs must be foreseen in advance.

Common problems in data collection

Sometimes companies have a lot of "old" data in their databases or information systems: they do not know what to do with it, and they re-collect data that already exists because it must be clean or something similar. In many business processes it is unclear which data is possible to collect (also due to privacy issues) and which data is really useful for the business.

The two routes

RouteWhyWatch out for
Publicly available data (datasets or databases)Someone collected them for us. They can be free or for a fee.The quality of the data made available must be checked.
Acquire a new set of dataIt is not certain that public data well represents the problem we want to solveCost, time, hardware, and the bugs you notice at the end
We want specific data and thus generate specific expertise for the company (know-how)
We are forced to acquire data that, due to its sensitive nature, would not otherwise be available (privacy issues)
The company we work for already has a collection process that we can use

Many universities publicly release their datasets: there are no requirements related to profit or non-disclosure agreements; it is the basis of the scientific method, in particular for the reproducibility of the results obtained — I release my data so that others can conduct my experiments and verify my results. The example given is ImageNet. Some platforms make datasets available for competitions, such as Kaggle.

7. Describe the data: profiling Iris

The key question of the description step: does the data acquired satisfy the relevant requirements? This step also provides a basic understanding of the data on which subsequent steps will be built. For instance, if age is important and the data does not reflect the entire age range, it may be wise to collect a different dataset.

The data analyst examines the "surface" properties of the acquired data:

The Iris dataset

The public dataset used throughout the module: Iris, used in R. A. Fisher's classic 1936 paper, also found on the UCI Machine Learning Repository. It includes 3 iris species (Setosa, Virginica, Versicolor) with 50 samples each, and characterizes flowers with five columns: SepalLengthCm, SepalWidthCm, PetalLengthCm, PetalWidthCm, Species.

IdSepalLengthCmSepalWidthCmPetalLengthCmPetalWidthCmSpecies
15.13.51.40.2Iris-setosa
24.931.40.2Iris-setosa
34.73.21.30.2Iris-setosa
44.63.11.50.2Iris-setosa
553.61.40.2Iris-setosa

Profiling the schema

RangeIndex: 150 entries, 0 to 149
Data columns (total 5 columns):
 #  Column              Non-Null Count   Dtype
---  ------             --------------   -----
 0  sepal length (cm)   150 non-null     float64
 1  sepal width (cm)    150 non-null     float64
 2  petal length (cm)   150 non-null     float64
 3  petal width (cm)    150 non-null     float64
 4  species             150 non-null     object
dtypes: float64(4), object(1)
memory usage: 6.0+ KB

Three facts are readable at a glance and all three matter: 150 entries, 150 non-null in every column (no missing values — Chapter 5 would otherwise have work to do), and the dtypes: four floats and one object, i.e. the species is categorical and will need encoding (Chapter 6) for algorithms that require numeric input.

Profiling the distribution

IdSepalLengthCmSepalWidthCmPetalLengthCmPetalWidthCm
count150150150150150
mean75.55.843333.0543.758671.19867
std43.44540.8280660.4335941.764420.763161
min14.3210.1
25%38.255.12.81.60.3
50%75.55.834.351.3
75%112.756.43.35.11.8
max1507.94.46.92.5
Key idea

Look at PetalLengthCm: mean 3.76 but median 4.35, and the 25% quartile at 1.6 while the 75% is at 5.1. The distribution is not a single hump — it is the signature of the three species sitting in different places, which is exactly what the exploration step will show. Note also the Id column, dutifully profiled with mean 75.5: a reminder that a profiling tool describes whatever you give it, including columns that carry no information (Chapter 6 removes them with a variance threshold, or by simply not selecting them).

8. The box plot and the five-number summary

In descriptive statistics, a box plot shows graphically the locality, spread, and skewness of numerical data. It is a standardized way of displaying the dataset based on the five-number summary:

  1. Minimum (Q0 or 0th percentile): the lowest data point
  2. First quartile (Q1 or 25th percentile)
  3. Median (Q2 or 50th percentile): the middle value
  4. Third quartile (Q3 or 75th percentile)
  5. Maximum (Q4 or 100th percentile): the highest data point

The interquartile range is IQR = Q3 − Q1. The graphical elements:

BOX PLOT ANATOMY — IRIS, SEPAL LENGTH (cm) 4.0 5.0 6.0 7.0 8.0 min 4.3 Q1 5.1 median 5.8 Q3 6.4 max 7.9 IQR = Q3 - Q1 = 1.3 fence Q1 - 1.5*IQR = 3.15 fence Q3 + 1.5*IQR = 8.35 no observation falls beyond the fences: the whiskers stop at the extreme values, and there are no outliers a point beyond a fence is plotted as an outlier
Plate 4.3 — The five-number summary of Iris sepal length, drawn to scale from the profiling table. The whiskers reach the furthest observation still inside the 1.5·IQR fences, which is why they are usually of different lengths.

Widget — build the box plot from the profiling table

Pick a column: the five numbers are the ones printed in the profiling table above; IQR, fences and the outlier verdict are computed live.

9. Explore the data

This task tackles the data mining questions, which can be addressed using querying, visualization, and reporting. Two deliverables:

On Iris the deck does exactly that: value distributions per species (petal_length vs species, sepal_length vs species) and a 2D visualization of the dataset.

EXPLORING IRIS IN TWO DIMENSIONS petal length (cm) petal width (cm) 1 3 5 7 0 1.0 2.0 setosa versicolor virginica one cut on petal length already separates setosa from the rest versicolor and virginica overlap: this is where the classifiers of Chapter 8 spend their errors
Plate 4.4 — Schematic scatter of Iris in the two petal dimensions, drawn to the ranges reported in the profiling table. Exploration is what tells you, before any model, that a single threshold on petal length isolates one species — and predicts that the feature importance in Chapter 8 will be 1.0 for petal length.

10. Verify data quality

At this point the analyst examines the quality of the data. The common issues to check:

CheckExample from the deck
Missing values or attributesUnknown date of death — is it missing? is the person alive?
Whether all possible values are representedAre all age groups contained in the dataset?
Plausibility of values: review any attributes that may give answers conflicting with common senseTeenagers with high income
Whether attributes with different values have similar meaningslow fat and diet
The spelling of valueslaw fat or low fat?

Applied to the running example, the verdict is short: nothing to worry about in Iris — 150 non-null values in all five columns, four plausible float measurements and a clean categorical.

Widget — classify the quality issue

The deck closes with two references that formalise all of this: Dimensions of Data Quality (Sidi et al. 2012) and Metrics of Data Quality (Batini et al. 2009) — the literature that turns the checklist above into measurable dimensions.

For the exam

Be able to recite the four steps and to give one concrete example of each quality check. The subtle one is the fourth: attributes with different values that have similar meanings. It is not a typo problem — low fat and diet are both spelled correctly and mean nearly the same thing, so a naive one-hot encoding (Chapter 6) will create two columns for one concept and split the evidence between them.

Check your understanding

What are the four steps of data understanding, and why is the phase critical?

(1) Collection of initial data, (2) description of data, (3) exploration of data, (4) verification of data quality. It is critical in preventing problems during data preparation, which is typically the longest part of a project — 50 to 70 percent of the effort. Data understanding itself takes 20 to 30 percent.

Explain survivorship bias with the aircraft example.

The red dots mark where surviving planes were shot. Reinforcing those areas is exactly wrong: those are hits a plane could take and still come home. The planes hit in the unmarked areas — engines, cockpit — never returned, so they are absent from the sample. Generally: the survivors get studied while the failures are excluded, leading to potentially flawed conclusions. The same structure appears in start-up success stories, fitness testimonials and portfolios of top-performing stocks.

Give the two definitions of bias used in the deck.

(1) Inclination or prejudice for or against one person or group, especially in a way considered to be unfair. (2) A systematic distortion of a statistical result due to a factor not allowed for in its derivation.

Distinguish selection bias, sampling bias and response bias.

Selection: the sample used for data collection is not representative of the population being studied. Sampling: certain segments of the population are more likely to be included or excluded from the sample. Response: participants in a survey or study provide inaccurate or misleading responses — the brown spot questions about legally constrained pesticides are a textbook case.

What is fairness, and which variables make a decision unfair?

Fairness refers to the various attempts to correct algorithmic bias in automated decision processes based on ML models. Decisions may be considered unfair if they were based on sensitive variables, e.g. gender, ethnicity, sexual orientation or disability. The cases cited: Amazon scrapping a secret AI recruiting tool biased against women (2018), and a Google AI tool producing offensive historical images (2024).

State the one in ten rule and apply it.

According to the one in ten rule (Chowdhury and Turin 2020), one variable can be considered in a model for every 10 events. There is no set rule for the number of variables to include, but this one is quite popular in traditional clinical prediction modeling (logistic regression, survival models). Applied to the brown spot project: 100 attributes would need on the order of 1000 events, and the dataset had 100 rows — hence "not statistically relevant".

List the five numbers of the five-number summary and define the IQR and the whiskers.

Minimum (Q0, 0th percentile), first quartile (Q1, 25th), median (Q2, 50th), third quartile (Q3, 75th), maximum (Q4, 100th). IQR = Q3 − Q1. The box is drawn from Q1 to Q3; the whiskers are based on 1.5 · IQR and are drawn up to the largest/lowest observed data point that falls within that distance, so their lengths can look unequal; all points outside are plotted as outliers.

What does a box plot show, and what does the Iris profiling table tell you before any plot?

A box plot shows graphically the locality, spread and skewness of numerical data. The Iris profiling: 150 entries, all columns 150 non-null (no missing values), four float64 and one object column (the species will need encoding), and a petal length whose mean (3.76) sits well below its median (4.35) with quartiles at 1.6 and 5.1 — the fingerprint of three species occupying different ranges.

Name the five data quality checks with an example each.

Missing values (unknown date of death: missing, or the person is alive?); whether all possible values are represented (all age groups present?); plausibility (teenagers with high income); attributes with different values but similar meanings (low fat and diet); spelling (law fat or low fat?).

Why acquire a new dataset instead of using a public one?

Four reasons: public data may not well represent the problem we want to solve; we want specific data and thus generate specific know-how for the company; we are forced to collect data that, being sensitive, would not otherwise be available; the company already has a collection process we can use. The cost side: programming or learning an acquisition tool, handling large amounts of data, testing for bugs (often noticed at the end of the process), and new hardware — with management and economic considerations, not only engineering ones.

Why do universities release their datasets publicly?

Because there are no profit or NDA requirements and it is the basis of the scientific method, in particular for the reproducibility of results: I release my data so that others can conduct my experiments and verify my results. ImageNet is the example given; Kaggle is cited as a platform releasing datasets for competitions.

What is the Iris dataset, and why is it used all the way through this course?

Public data used in R. A. Fisher's classic 1936 paper, available from the UCI Machine Learning Repository: 3 species (Setosa, Virginica, Versicolor), 50 samples each (150 rows), four measurements per flower plus the species. It is small, clean ("nothing to worry about in Iris"), and just structured enough to demonstrate description, exploration, PCA, decision trees, k-NN and neural networks without any data quality noise in the way.