Data Warehousing and Data Mining: Data Preprocessing and Association Rule Mining

Data Preprocessing Overview

  • Real-World Data Imperfections:

    • Incomplete: Lacking specific attribute values, lacking attributes of interest, or containing only aggregate data.

    • Noisy: Containing errors or outliers.

    • Inconsistent: Containing discrepancies in naming conventions or coding systems.

  • Core Preprocessing Tasks:

    • Data Cleaning: Filling in missing values, smoothing noisy data, identifying and removing outliers, and resolving inconsistencies.

    • Data Integration: Merging data from heterogeneous repositories (databases, data cubes, or flat files).

    • Data Transformation: Normalization, data aggregation, and generalization.

    • Data Reduction: Compacting dataset volume while delivering identical or highly similar analytical results.

    • Data Discretization: Transforming continuous numerical attributes into categorical/nominal intervals.

Forms of data preprocessing

Data Cleaning

  • Methods for Handling Missing Values:

    • Ignore the tuple: Typically used when the target class label is missing in classification tasks; ineffective when the missingness percentage fluctuates widely across attributes.

    • Fill in manually: Accurate but prohibitively time-consuming for large datasets.

    • Use a global constant: Substituting missing cells with a constant label like "Unknown" or −∞\mathbf{-\infty}.

    • Use the attribute mean: Substituting with the overall mean of the attribute for all known tuples.

    • Use the attribute mean for the same class: Substituting with the attribute mean of tuples sharing the same class label.

    • Use the most probable value: Estimating the missing entry through regression, Bayesian inference, or decision tree induction.

  • Techniques for Smoothing Noisy Data:

    • Binning (Local Smoothing): Distributes sorted values into bins and smooths by:

    • Bin means: Replaces each bin element with the mean of the bin.

    • Bin medians: Replaces each bin element with the median of the bin.

    • Bin boundaries: Replaces each bin element with the closest minimum or maximum boundary value of the bin.

    • Regression: Fits attributes to parametric mathematical equations (simple linear regression or multiple linear regression).

    • Clustering: Groups similar data points together; values falling outside designated clusters are flagged as outliers.

Data Integration

  • Primary Integration Challenges:

    • Entity Identification Problem: Matching equivalent real-world entities across disparate sources (e.g., matching customer_id with customer_number).

    • Data Value Conflicts: Resolving conflicting values caused by divergent scaling, representations, or unit encodings.

    • Redundancy: Detecting duplicated or derivable attributes through correlation analysis.

  • Correlation Analysis for Numerical Attributes:

    • Evaluated using Pearson's product moment coefficient (rA,Br_{A,B}):

rA,B=∑i=1N(ai−Aˉ)(bi−Bˉ)NσAσB=∑i=1N(aibi)−NAˉBˉNσAσBr_{A,B} = \frac{\sum_{i=1}^{N} (a_i - \bar{A})(b_i - \bar{B})}{N \sigma_A \sigma_B} = \frac{\sum_{i=1}^{N} (a_i b_i) - N \bar{A} \bar{B}}{N \sigma_A \sigma_B}

  • If rA,B>0r_{A,B} > 0, attributes AA and BB are positively correlated. Note: Correlation does not imply causality.

    • Correlation Analysis for Categorical Attributes:

  • Evaluated using the Chi-Square (χ2\chi^2) test over an r×cr \times c contingency table:

χ2=∑i=1c∑j=1r(oij−eij)2eij\chi^2 = \sum_{i=1}^{c} \sum_{j=1}^{r} \frac{(o_{ij} - e_{ij})^2}{e_{ij}}

  • The expected frequency (eije_{ij}) is computed as:

eij=count(A=ai)×count(B=bj)Ne_{ij} = \frac{\text{count}(A = a_i) \times \text{count}(B = b_j)}{N}

  • Evaluated under (r−1)×(c−1)(r - 1) \times (c - 1) degrees of freedom to determine statistical dependence.

Data Transformation

  • Transformation Strategies:

    • Smoothing: Removing noise through binning, regression, or clustering.

    • Aggregation: Computing summarizations across dimensions (e.g., daily sales aggregated into annual totals).

    • Generalization: Substituting low-level primitive values with higher-level concepts using concept hierarchies (e.g., street to city, age to senior).

    • Attribute Construction: Deriving and adding new features to aid data mining.

  • Normalization Methods:

    • Min-Max Normalization: Scales an original value vv linearly into [new_minA,new_maxA][\text{new\_min}_A, \text{new\_max}_A]:

v′=v−min⁡Amax⁡A−min⁡A(new_maxA−new_minA)+new_minAv' = \frac{v - \min_A}{\max_A - \min_A} (\text{new\_max}_A - \text{new\_min}_A) + \text{new\_min}_A

  • Z-Score Normalization (Zero-Mean Normalization): Scales values using the attribute mean (Aˉ\bar{A}) and standard deviation (σA\sigma_A):

v′=v−AˉσAv' = \frac{v - \bar{A}}{\sigma_A}

  • Decimal Scaling: Normalizes by shifting decimal points according to the maximum absolute value:

v′=v10jv' = \frac{v}{10^j}

  • The parameter jj represents the smallest integer such that max⁡(∣v′∣)<1\max(|v'|) < 1.

Data Reduction

  • Data Cube Aggregation:

    • Aggregates multi-dimensional data into cuboids; the lowest abstraction level is the base cuboid, and the highest single-cell summary is the apex cuboid.

  • Attribute Subset Selection (Feature Selection):

    • Heuristic greedy techniques include stepwise forward selection, stepwise backward elimination, combined forward-backward approaches, and decision tree induction.

  • Dimensionality Reduction:

    • Discrete Wavelet Transform (DWT): A linear signal processing method that decomposes vectors into wavelet coefficients; preserves spatial locality better than the Discrete Fourier Transform (DFT). Common families include Haar-2, Daubechies-4, and Daubechies-6.

    • Principal Components Analysis (PCA / Karhunen-Loeve method): Computes kk orthonormal unit vectors (k≤nk \le n) that maximize variance, mapping the data into a lower-dimensional coordinate system.

Principal components analysis
  • Numerosity Reduction:

    • Parametric: Mathematical models where only parameters are stored (e.g., linear regression, multiple regression, log-linear models).

    • Nonparametric: Histograms (equal-width, equal-frequency, V-Optimal, MaxDiff), clustering, and sampling techniques (SRSWOR, SRSWR, cluster sampling, stratified sampling).

Association Rule Mining Fundamentals

  • Core Definitions:

    • Frequent Patterns: Itemsets, subsequences, or substructures that occur in a dataset with a frequency above a defined threshold.

    • Market Basket Analysis: Uncovers buying associations between products co-occurring in transactional baskets.

  • Interestingness Measures:

    • Support: Probability that a transaction contains the combined itemset A∪BA \cup B:

Support(A⇒B)=P(A∪B)\text{Support}(A \Rightarrow B) = P(A \cup B)

  • Confidence: Conditional certainty that item BB is present given item AA is present:

Confidence(A⇒B)=P(B∣A)=support_count(A∪B)support_count(A)\text{Confidence}(A \Rightarrow B) = P(B|A) = \frac{\text{support\_count}(A \cup B)}{\text{support\_count}(A)}

  • Two-Step Mining Process:

    1. Identify all frequent itemsets that satisfy the minimum support count (min_sup\text{min\_sup}).

    2. Extract strong association rules from frequent itemsets that satisfy both min_sup\text{min\_sup} and minimum confidence (min_conf\text{min\_conf}).

The Apriori Algorithm

  • Foundation: Proposed by R. Agrawal and R. Srikant (1994) for discovering Boolean association rules using iterative level-wise candidate generation.

  • The Apriori Property (Antimonotonicity):

    • All nonempty subsets of a frequent itemset must also be frequent.

    • If an itemset II is infrequent (P(I)<min_supP(I) < \text{min\_sup}), then adding any item AA to II produces an infrequent superset (P(I∪A)<min_supP(I \cup A) < \text{min\_sup}).

  • Level-Wise Iteration Steps (Lk−1→LkL_{k-1} \rightarrow L_k):

    • Join Step: Generates candidate itemsets CkC_k by joining Lk−1L_{k-1} with itself (Lk−1×Lk−1L_{k-1} \times L_{k-1}).

    • Prune Step: Discards any candidate itemset in CkC_k that contains an infrequent (k−1)(k-1)-subset.

    • Database Scan: Counts occurrences of remaining CkC_k candidates in database DD to form frequent set LkL_k.

Association Rule Generation

  • Rule Derivation Pipeline:

    • For every frequent itemset ll, compute all nonempty subsets ss.

    • Construct association rules of the form s⇒(l−s)s \Rightarrow (l - s).

    • Keep rules that meet or exceed min_conf\text{min\_conf}:

Confidence=support_count(l)support_count(s)≥min_conf\text{Confidence} = \frac{\text{support\_count}(l)}{\text{support\_count}(s)} \ge \text{min\_conf}

  • Rules generated from frequent itemsets automatically satisfy the minimum support threshold.

Mining Frequent Itemsets without Candidate Generation (FP-Growth)

  • FP-Growth Architecture:

    • Uses a divide-and-conquer strategy to avoid expensive candidate generation and repeated database scans.

    • Compresses the database into a compact Frequent-Pattern Tree (FP-tree) that retains complete itemset association details.

  • Tree Construction Process:

    • Scan 1: Identifies frequent 1-itemsets and sorts them in descending order of support count into list LL.

    • Scan 2: Reads transactions sequentially, reorders their items according to LL, and maps them into tree branches rooted at a "null" node, sharing common prefixes and incrementing node counts.

An FP-tree registers compressed, frequent pattern information
  • Mining the FP-Tree:

    • Traverses frequent items starting from the bottom of list LL (suffix patterns).

    • Constructs a conditional pattern base (prefix paths co-occurring with the suffix).

    • Builds a conditional FP-tree from the conditional pattern base.

    • Recursively concatenates suffix items with patterns derived from conditional FP-trees to output frequent patterns.