Source: 2_DM_preprocessing.pdf.

How to use this note

This follows the lecture: data and attributes -> why preprocessing -> cleaning -> integration/transformation -> reduction -> discretization. Every method states both what it does and when/why it is used.

1. Data sets, objects, and attributes

A data set commonly corresponds to one database table or statistical data matrix. A row is a data object - for example, a customer, sales record, patient, student, professor, course, or product. A column describes an attribute of each object.

Attribute types

TypeDefinitionExample
NominalUnordered names/symbolshair_colour, marital_status
BinaryNominal attribute with two states, usually 0/1smoker; symmetric when both states have equal importance, asymmetric otherwise
OrdinalOrdered categories but unknown distance between ranksgrades; satisfaction from very dissatisfied to very satisfied
Interval-scaledEqual-size units, arbitrary zerotemperature in Celsius
Ratio-scaledNumeric scale with meaningful zero and ratiosweight, price, age
DiscreteFinite/countably infinite valuesnumber of children, ZIP code
ContinuousAny value in a range up to measurement precisionheight, temperature

Quantitative attributes represent measurable quantities. Qualitative attributes describe a characteristic without a numerical magnitude; nominal, binary, and ordinal attributes are qualitative.

PYQ — 2021 CT Set 1 CO1; 2022 semester CO1 Q1(a)

Explain nominal, ordinal, numeric and discrete attributes with examples.

2021 class test Set 1, CO1

2022 semester CO1 Q1(a)

Answer

Nominal values have no order (colour); ordinal values have order (low/medium/high); numeric values measure quantities (temperature); discrete values have countable possible values (number of visits). Numeric and discrete are not mutually exclusive.

Data types and forms

The usual representation is attribute-value data. Data may be numeric/categorical and static/dynamic (temporal). Mining must also deal with distributed data, text/Web/metadata, and image/audio/video data.

PYQ — 2021 CT Set 4 CO1; 2022 semester CO1 Q1(b)

Differentiate a data set and a data object with examples.

2021 class test Set 4, CO1

2022 semester CO1 Q1(b)

Answer

A data set is a collection of objects; a data object is one entity described by attributes. A student table is a data set; one student’s row is an object.

2. Why data preprocessing?

Real data is frequently:

  • incomplete: values/attributes are missing or only aggregated data is present, e.g. occupation = "";
  • noisy: it contains random error, variance, or outliers, e.g. salary = -10; and
  • inconsistent: codes, names, or related fields conflict, e.g. age = 42 inconsistent with a birthday, or ratings stored as both 1,2,3 and A,B,C.

Poor data quality produces poor mining results and misleading statistics. Cleaning and transformation can account for about 90% of the work in a data-mining application, so preprocessing is not an optional cosmetic step.

Data quality

Assess data using accuracy, completeness, consistency, timeliness, believability, value added, interpretability, and accessibility.

3. The preprocessing workflow

flowchart LR R[Raw data] --> C[Cleaning] C --> I[Integration] I --> T[Transformation] T --> R2[Reduction] R2 --> D[Discretization / mining-ready data] C -. fix errors .-> R I -. resolve conflict .-> C

Lecture figure - major preprocessing tasks

  1. Data cleaning: handle missing values, noise, outliers, inconsistency, and duplicates.
  2. Data integration: combine multiple databases/files.
  3. Data transformation: normalize, aggregate, construct attributes, or smooth data.
  4. Data reduction: preserve a similar analytical result with less data.
  5. Data discretization: replace continuous values by intervals and form concept hierarchies.
PYQ — 2021 CT Set 3 CO1; 2022 semester CO1 Q1(b)

Describe methods used in the four levels of preprocessing with examples.

2021 class test Set 3, CO1

2022 semester CO1 Q1(b)

Answer

The four major preprocessing tasks and examples are:

  1. Cleaning: handle missing or erroneous values and smooth noise. For example, impute missing age using an appropriate median, or inspect an implausible age.
  2. Integration: combine sources and resolve schema, entity and value conflicts. For example, reconcile customer_id across billing and support tables.
  3. Transformation: change data into a suitable form. Min–max normalization maps a value to when the range is nonzero; aggregation combines daily sales into monthly totals.
  4. Reduction: make the data smaller while preserving useful information. Feature selection drops irrelevant attributes; aggregation or sampling reduces the amount of data.

The suitable technique depends on the data and analysis objective; preprocessing choices can introduce bias or information loss.

4. Data cleaning

Missing data

Values can be missing because equipment failed, entry was omitted/misunderstood, a value conflicted and was removed, history was not registered, or the field seemed unimportant at collection time.

MethodHow it worksMain limitation
Ignore tupleDrop the recordWasteful/biasing if many records are affected
Fill manuallyAsk/check original sourceAccurate but infeasible at scale
Global constantUse unknown or another markerCan create an artificial category
MeanUse attribute mean, preferably class-conditional mean when labels existReduces variance; poor for skew/outliers
Most probable valueInfer with decision tree, Bayesian method, regression, or EMNeeds a reliable model
PYQ - 2025, CO2(a)

Describe two methods for handling missing values for some attributes in real-world data. Discuss about the various types of patterns which can be mined for some business applications. Describe the measures of multidimensional data model.

2025 semester CO2(a), all three parts

Answer

Method 1 - mean/class-conditional mean: replace a missing numeric value with the attribute mean, or the mean for the tuple’s class. It is fast, but can hide variation and be distorted by skewed data.

Method 2 - most-probable-value imputation: use a decision tree, Bayesian classifier, regression, or EM to predict the missing value from other attributes. It uses relationships in data but depends on the model being valid.

Business patterns include characterization (profile profitable customers), discrimination (buyers versus non-buyers), association/correlation (bread -> butter), classification (likely churn), regression (future sales), clustering (customer segments), outlier detection (fraud), and sequential/evolution patterns (purchase order/trends).

A data-cube measure is a numeric value at a cube cell, e.g. sales or units sold. Distributive measures (SUM, COUNT, MIN, MAX) combine partition aggregates directly. Algebraic measures (AVG, standard deviation) use a fixed number of distributive summaries. Holistic measures (median, mode, rank) have no fixed-size exact summary.

PYQ — 2024 CT1 Q3(b)

Describe two methods for handling missing values.

Original question from the supplied paper

Answer

Delete affected records where appropriate, or impute a value such as a median or a model prediction; consider missingness and potential bias.

Noisy data and smoothing

Noise is random error or variance in a measured variable. Causes include faulty collection instruments, data-entry mistakes, and transmission errors. The lecture gives three responses:

  1. Binning: sort values, partition into equal-depth bins, then smooth by bin mean, median, or nearest boundary.
  2. Clustering: sparse/distant objects can be recognized as outliers.
  3. Computer + human inspection: flag suspicious values and check them with a person.

For sorted prices 4,8,9,15 | 21,21,24,25 | 26,28,29,34, smoothing by means gives 9,9,9,9 | 22.75,22.75,22.75,22.75 | 29.25,29.25,29.25,29.25. Boundary smoothing gives 4,4,4,15 | 21,21,25,25 | 26,26,26,34.

Lecture figure - binning methods for smoothing

PYQ - 2026, CO2(b)

(i) What is entropy-based binning method? (ii) Consider . Use smoothing by bin means, with bin depth 3.

2026 semester CO2(b), entropy-based binning and the full input values

Answer

(i) Entropy-based binning is supervised discretization. Sort attribute-value/class pairs, test cuts between consecutive values, and choose the cut with maximum information gain (minimum weighted class entropy). Repeat when a further split is useful, producing relatively pure class intervals.

(ii) Sort first: 3,4,5 | 5,5,6 | 7,7,7 | 8,8,9 | 12,12,12 | 12,13,13 | 13,19.

BinMeanSmoothed bin
3,4,54,4,4
5,5,65.33,5.33,5.33
7,7,77,7,7
8,8,98.33,8.33,8.33
12,12,1212,12,12
12,13,1312.67,12.67,12.67
13,1916,16

Final smoothed sorted sequence: 4,4,4,5.33,5.33,5.33,7,7,7,8.33,8.33,8.33,12,12,12,12.67,12.67,12.67,16,16.

PYQ — bin smoothing practice

2024 CT1 Q4: Smooth the given sorted ages by bin means, using a bin depth of 3.

Original question from the supplied paper

Answer

Split the 27 sorted ages into nine successive bins of three, then replace every value by its own bin mean.

BinMeanSmoothed values
13, 15, 1614.6714.67, 14.67, 14.67
16, 19, 2018.3318.33, 18.33, 18.33
20, 21, 222121, 21, 21
22, 25, 252424, 24, 24
25, 25, 3026.6726.67, 26.67, 26.67
33, 33, 3533.6733.67, 33.67, 33.67
35, 35, 353535, 35, 35
36, 40, 4540.3340.33, 40.33, 40.33
46, 52, 705656, 56, 56
PYQ — 2026 CT1 Q2(g)

Smooth the cricket scores shown below by bin means using a bin depth of four.

2026 class test cricket-score binning question

Answer

Sort the 20 scores and divide into five bins of four. Replace every score in a bin by that bin’s mean.

Sorted binCalculationSmoothed values
30, 125, 130, 133104.5, 104.5, 104.5, 104.5
136, 150, 160, 165152.75, 152.75, 152.75, 152.75
195, 200, 205, 210202.5, 202.5, 202.5, 202.5
220, 225, 235, 235228.75, 228.75, 228.75, 228.75
240, 245, 250, 313262, 262, 262, 262
PYQ — 2021 class test Set 4 CO1

Smooth the supplied twelve values by equal-frequency bin means and bin boundaries.

2021 equal-frequency smoothing question

Answer

The question does not specify the number of bins. Assume three bins of depth four: 4, 8, 9, 15 | 21, 21, 24, 25 | 26, 28, 29, 34.

Means: The bin means are , and . Replacing each value with its bin mean gives 9, 9, 9, 9 | 22.75, 22.75, 22.75, 22.75 | 29.25, 29.25, 29.25, 29.25.

Boundaries: Replace each value with the closest endpoint of its bin. The result is 4, 4, 4, 15 | 21, 21, 25, 25 | 26, 26, 26, 34. Different bin counts produce different answers.

Outliers

An outlier is a point inconsistent with most data. It may be valid (a CEO salary) or noisy (age 200). Detection/removal methods include clustering, curve fitting, and hypothesis testing; investigate before removal because an unusual point may be a fraud signal.

Lecture figure - outlier removal approaches

PYQ - 2026, CO2(c)

Explain noisy data. What is an outlier? Find out outliers in using boxplots or histogram analysis.

2026 semester CO2(c), outlier analysis and the full dataset

Answer

Noise is random error/variance caused by collection, entry, or transmission problems. An outlier is an observation exceptionally far from/general behaviour.

Sorted : 0.11,0.18,0.23,0.51,1.19,1.30,1.32,1.73,2.06,2.16,2.37,2.91,4.50,4.51,4.66,14.68,14.82,27.44,39.41,41.04,49.09,60.05.

With 22 values, , , and . The fences are and . Every value lies inside the fences, so the standard 1.5-IQR boxplot rule finds no formal outlier. A histogram has a long right tail; high values such as 39.41,41.04,49.09,60.05 should be investigated, but are not boxplot outliers under this rule.

PYQ — outliers, 2022 semester CO2 Q2(a)(ii); 2026 CT1 Q1(d); 2024 CT1 Q3(b)

Use a boxplot to identify outliers in the 2022 dataset shown below and in the 2026 marks 12, 12, 15, 18, 20, 22, 25, 27, 28, 35. Give an application of outlier analysis.

Original question from the supplied paper

Additional original question

Additional original question

Answer

Use the median-of-halves convention, excluding the overall median when the sample size is odd. For the 2022 data, , and . The fences are and ; hence 6.98, 49.15, 50.57 and 60.05 are outliers.

For the 2026 marks, , and . The fences are and ; no marks are outliers under this rule. Different quartile conventions can change the fences.

An application is detecting unusual credit-card transactions for fraud investigation; an outlier is a flag, not proof of fraud.

5. Data integration

Data integration combines data from multiple sources. Its central issues are:

  • schema integration: reconcile names/types/structures, e.g. A.cust_id and B.cust_no;
  • entity identification: decide whether source records refer to the same real entity;
  • redundancy/correlation: remove attributes derivable from others and avoid duplicated information;
  • duplicate tuples: find repeated records created by merging; and
  • data-value conflicts: standardize units, currencies, dates, codes, scales, and conventions.

For redundancy analysis, the lecture uses a chi-square test for nominal attributes and correlation coefficient/covariance for numeric attributes. These identify attributes that carry overlapping information before modelling.

Lecture figure - data integration issues

PYQ - 2026, CO2(a)

Discuss issues to be considered during data integration. What is the curse of dimensionality? How can it be reduced?

2026 semester CO2(a), data integration and dimensionality

Answer

The integration issues are schema integration, entity identification, redundancy/correlation, duplicate-tuple detection, and data-value conflicts, as listed above.

The curse of dimensionality occurs when many attributes make the space sparse: distance/similarity becomes less meaningful, computation/storage grows, and far more data is needed to represent the space. Reduce it using attribute-subset selection, dimensionality reduction/projection, aggregation, discretization, sampling, or removal of redundant/irrelevant attributes.

PYQ — 2026 CT1 Q2(f)

Explain data integration with an example.

Original question from the supplied paper

Answer

Combine data from multiple sources into a consistent view, resolving entity identity, schema differences and duplicates; for example, merge customer records from sales and support using a shared customer ID.

6. Data transformation

  • Smoothing: remove noise.
  • Attribute/feature construction: derive a new useful attribute from existing ones.
  • Aggregation: summarize data, e.g. daily sales -> monthly sales.
  • Generalization: replace low-level values with higher-level concepts.

Normalization

MethodFormulaUse
Min-maxMap values to a specified range.
Z-scoreCentre at 0 and scale by standard deviation.
Decimal scaling, smallest with $\max(v’

Lecture figure - normalization formulae

7. Data reduction

Reduction obtains a much smaller representation while preserving the same or a similar analysis result.

  • Dimensionality reduction: feature/attribute subset selection removes irrelevant attributes. Forward selection, backward elimination, stepwise methods, and combinations are common heuristics.
  • Histograms: divide a range into buckets and store aggregate values per bucket.
  • Clustering: retain cluster representations/centroids instead of all objects when suitable.
  • Sampling: choose a representative subset. Simple random sampling can miss skewed minorities; stratified sampling preserves class/subpopulation proportions.

Lecture figure - cluster/stratified sampling

PYQ — 2026 CT1 Q2(a)

What is dimensionality reduction?

Original question from the supplied paper

Answer

Reduce the number of features while preserving useful information, using feature selection or feature extraction such as PCA.

8. Discretization and concept hierarchy

Discretization divides a continuous attribute range into intervals and replaces actual values by interval labels. It reduces the number of values/noise and prepares numeric data for algorithms that accept categorical input.

TechniqueRule
Equal-width binningSame numerical width per interval.
Equal-frequency/equi-depth binningApproximately the same number of values per interval.
Entropy-based binningSelect cut with maximum information gain.

For values 0,4,12,16,16,18,24,26,28, width 10 gives [-∞,10), [10,20), [20,+∞). Equi-depth bins of three give [-∞,14), [14,21), [21,+∞): each interval contains approximately three observations.

Lecture figure - equal-width and equal-frequency binning

Lecture figure - entropy-based binning

Entropy-based binning

This is a supervised discretization method: each numeric value has a class label. For the lecture data

(0,P), (4,P), (12,P), (16,N), (16,N), (18,P), (24,N), (26,N), (28,N),

try candidate cuts at midpoints between consecutive distinct values. A cut at produces and . Choose the cut with the greatest information gain:

Lower entropy means a purer bin; zero means all values in that bin have one class. In the example, gives . Examine all candidate cuts and select the one with maximum gain (equivalently, minimum weighted information).

A concept hierarchy generalizes a detailed value to a higher-level value: age -> young/middle-aged/senior or street -> city -> province_or_state -> country. It supports data reduction, roll-up, and generalized mining. At schema level, the hierarchy can be declared as the total ordering street < city < province_or_state < country.

Lecture figure - concept hierarchy generation

PYQ - 2025, CO2(b)

Discuss about discretization and concept hierarchy generation for numerical data.

2025 semester CO2(b), discretization and concept hierarchies

Answer

Discretization replaces many continuous numeric values with a few interval labels. Explain equal-width, equal-frequency, and entropy-based splitting, and note that it reduces noise/data size and enables categorical algorithms. A concept hierarchy replaces low-level values with higher-level concepts, e.g. 23 -> young and street -> city -> state -> country; it supports roll-up/generalized mining.

PYQ - 2026, CO4(b)(ii)

What is discretization? When is it used?

2026 semester CO4(b)(ii), discretization

Answer

Discretization converts a continuous numerical attribute into labelled intervals. Use it to reduce data/noise, form concept levels, improve interpretability, and prepare numeric data for a mining/classification algorithm requiring categorical input.

PYQ — 2026 CT1 Q2(e)

Why is discretization used?

Original question from the supplied paper

Answer

It replaces numerical values with intervals, simplifying models and enabling methods that use categorical attributes; information may be lost.

9. Summary

Prepare data before mining: clean it, integrate sources, transform values, reduce size/dimensions, and discretize where appropriate. These choices directly affect the correctness, efficiency, and interpretability of every later mining result. Many preprocessing methods exist, and the area remains active research.