Skip to content
GATEiit

GATE DA · Database Management and Warehousing

Data types; data transformation: normalization, discretization, sampling and compression

Attribute types (nominal, binary, ordinal, interval, ratio) and the preprocessing steps that prepare data for mining: min-max, z-score and decimal-scaling normalization, binning, sampling and data reduction. GATE asks short numericals and type-identification questions.

Before you start

This topic comes before: Clustering algorithms: k-means and k-medoid, Concept hierarchies; measures: categorization and computations

Concept notes

1. Attribute (data) types

An attribute is a column of the data. Its type decides which operations and statistics make sense.

  • Nominal: names or labels with no order (colour, PIN code, roll number). Only equality tests; the central value is the mode.
  • Binary: nominal with two states (0/1). Symmetric if both states matter equally (gender), asymmetric if one state is rare and important (test positive).
  • Ordinal: values have a meaningful order but the gaps are not equal (grade A/B/C, small/medium/large). Mode and median are valid; the mean is not.
  • Numeric, interval-scaled: equal-size units but no true zero (temperature in °C, calendar year). Differences are meaningful; ratios are not (20 °C is not twice as hot as 10 °C).
  • Numeric, ratio-scaled: has a true zero (Kelvin temperature, salary, length, count). Both differences and ratios are meaningful.

Separately, an attribute is discrete (finite or countably infinite values, e.g. number of children) or continuous (real values, e.g. height).

Type Order Difference Ratio Valid centre
Nominal No No No Mode
Ordinal Yes No No Mode, median
Interval Yes Yes No Mode, median, mean
Ratio Yes Yes Yes All, including geometric mean

2. Normalization: putting attributes on a common scale

Attributes measured in large units (salary in rupees) dominate distance-based methods such as k-NN and k-means. Normalization rescales each numeric attribute.

  • Min-max normalization maps [minA,maxA] linearly to [new_min,new_max]: v′=v−minAmaxA−minA(new_max−new_min)+new_min It keeps the relationships among values, but a new value outside the old range lands outside the new range, and one outlier squeezes all other values together.
  • z-score normalization uses the mean Aˉ and standard deviation σA: v′=v−AˉσA. Result has mean 0 and standard deviation 1. Use it when min and max are unknown or outliers are present.
  • Decimal scaling moves the decimal point: v′=v10j, where j is the smallest integer such that max⁡∣v′∣<1. If the largest absolute value is 986, j=3.

All three are linear maps, so they preserve the order of values. Store the parameters (min, max, mean, σ) so new data can be transformed the same way.

3. Discretization and binning

Discretization replaces a numeric attribute by interval labels (0–10, 10–20, …) or concept labels (youth, adult, senior). It reduces the number of distinct values and lets methods that need categorical input (decision trees, association rules) use the attribute.

Binning (unsupervised, top-down splitting):

  • Equal-width: divide the range into k intervals of width w=max−mink. Simple, but skewed data gives very uneven bin counts.
  • Equal-frequency (equal-depth): each bin holds about n/k sorted values.

Smoothing a sorted bin removes noise:

  • by bin means: replace every value by the bin mean;
  • by bin medians: replace by the bin median;
  • by bin boundaries: replace each value by the nearer of the bin's min and max.

Other discretization methods: histogram analysis, cluster analysis, and supervised entropy-based splitting that uses class labels to place the cut points. Discretizing repeatedly gives a concept hierarchy for the attribute.

Equal-width (w = 10) [5, 15): 5 values[15, 25): 3[25, 35]: 4 Equal-frequency (4 per bin) mean 8mean 17.5mean 29
The 12 values 5, 7, 8, 12, 14, 15, 19, 22, 25, 27, 29, 35 split into 3 bins: equal-width (top, counts 5, 3, 4) and equal-frequency (bottom, 4 per bin)

4. Sampling

Sampling represents a large data set of N tuples by a much smaller random subset of s tuples. Its cost depends on s, not on N.

  • SRSWOR (simple random sample without replacement): every tuple is equally likely; a drawn tuple cannot be drawn again. There are (Ns) possible samples, and each tuple is in the sample with probability sN.
  • SRSWR (with replacement): a drawn tuple is put back, so it may appear more than once. There are Ns ordered draws, and a given tuple appears at least once with probability 1−(1−1N)s.
  • Cluster sample: group tuples into M clusters (for example disk pages), then take an SRS of s whole clusters.
  • Stratified sample: split the data into disjoint strata (for example by age group) and take an SRS from each, usually in proportion to stratum size. It guarantees that small groups are represented, which helps with skewed data.

In proportional stratified sampling, stratum h of size Nh gets s⋅NhN tuples.

5. Data reduction and compression

Data reduction gives a much smaller representation that yields nearly the same analytical results.

  • Dimensionality reduction cuts the number of attributes: PCA projects onto the top principal components; wavelet transforms keep only the strongest coefficients; attribute subset selection drops irrelevant or redundant attributes.
  • Numerosity reduction replaces the data by a smaller form. Parametric: regression and log-linear models (store only the model parameters). Non-parametric: histograms, clustering (store cluster representatives), sampling, data cube aggregation.
  • Data compression encodes the data in fewer bits. Lossless compression lets you rebuild the original exactly (run-length coding, Huffman coding). Lossy compression rebuilds only an approximation (PCA, wavelets with dropped coefficients).

A simple measure is the compression ratio = original size / compressed size. Reduction is worth doing only if the time saved in mining exceeds the time spent reducing.

Formulas to remember

Min-max normalization
v′=v−minAmaxA−minA (new_max−new_min)+new_min
z-score normalization
v′=v−AˉσA
Decimal scaling
v′=v10j,j=smallest integer with max⁡∣v′∣<1
Equal-width bin sizek bins
w=max−mink
Number of SRSWOR samplesEach tuple is included with probability s/N
(Ns)
SRSWR inclusion probability
P(tuple appears)=1−(1−1N)s
Proportional stratified sample size
sh=s⋅NhN

Common mistakes

  • Treating codes written in digits (PIN code, roll number) as numeric; they are nominal.
  • Computing ratios on interval data such as °C or calendar year.
  • In decimal scaling, taking j from the number of digits of the largest positive value instead of the largest absolute value.
  • Forgetting the + new_min term when min-max normalizing to a range other than [0,1].
  • Mixing up equal-width (same interval length) with equal-frequency (same number of values) binning.
  • Using s/N as the inclusion probability for sampling with replacement; that formula holds only without replacement.

Worked examples

Try each step yourself, then reveal the working.

Example 1: Three normalizations of one column

numerical

An attribute has the values 2, 4, 4, 4, 5, 5, 7, 9. Normalize the value 4 by min-max to [0,1] and to [−1,1], and give the z-score of 9 (use the population standard deviation).

  1. Step 1: Read off min and max, then apply min-max to [0, 1].

    Try it on paper first.

Example 2: Equal-width vs equal-frequency binning with smoothing

numerical

Sorted values: 5, 7, 8, 12, 14, 15, 19, 22, 25, 27, 29, 35. Make 3 equal-width bins and 3 equal-frequency bins. Smooth the equal-frequency bins by bin means and by bin boundaries.

  1. Step 1: Find the equal-width bins and their counts.

    Try it on paper first.

Example 3: Counting samples and stratified allocation

numerical

(a) From N=10 tuples, a sample of s=3 is drawn. Find the number of possible SRSWOR samples, the number of ordered SRSWR draws, and the probability that a fixed tuple appears in each case. (b) A table of 1000 customers has strata of 600, 300 and 100. Allocate a proportional stratified sample of 50.

  1. Step 1: Count the samples.

    Try it on paper first.

Example 4: Identify the attribute type

conceptual

Classify: (i) temperature in °C, (ii) temperature in kelvin, (iii) customer satisfaction (poor, fair, good, excellent), (iv) PIN code, (v) HIV test result (positive/negative).

  1. Step 1: Ask: is there an order? Are gaps equal? Is there a true zero?

    Try it on paper first.

Previous year questions

1 official GATE DA question on this topic, newest first.

Practise these 1 PYQs →

Topic test

9 questions: up to 1 official PYQs and original practice questions, with GATE marking (MCQ wrong answers lose marks). Score 60% or more to pass. A new set is drawn each time.

Mark as mastered

Loading your progress…

My revision notes

Notes written by the GATEiit team against the official GATE DA syllabus; being checked by a reviewer. Updated 2026-11-21. Spotted a mistake? Use Report an issue on any question, or contact us.