UNIT 3: DATA MINING TECHNIQUES AND APPLICATIONS
I. DATA MINING PROCESS (KNOWLEDGE DISCOVERY IN DATABASES - KDD)
Steps Involved in KDD Process
The KDD process is an iterative, multi-step framework for extracting knowledge from data.
| Step | Purpose | Key Activities |
|---|---|---|
| 1. Selection | Define the problem scope | Identify target data, relevant datasets, and attributes from the data warehouse/database. |
| 2. Preprocessing | Improve data quality | Data Cleaning (handle noise, missing values), Data Integration (merge sources), Data Reduction (reduce volume). |
| 3. Transformation | Convert data to suitable form | Normalization (scaling), Aggregation, Attribute Construction, Discretization. |
| 4. Data Mining | Apply core algorithms | Select task (classification, clustering, association, etc.) and algorithm. Pattern search. |
| 5. Interpretation/Evaluation | Validate discovered patterns | Interpret mined patterns, assess interestingness (support, confidence), visualize results. |
| 6. Knowledge | Deploy knowledge | Use discovered knowledge in decision-making, integrate into system. |
[!TIP] Exam Focus: Be prepared to describe each step in 1-2 lines with an example. The process is cyclic—results from Interpretation may send you back to Selection/Preprocessing.
II. DATA PREPROCESSING
Data Transformation Strategies
Transformation prepares data for mining by converting it into appropriate forms.
| Strategy | Description | Example |
|---|---|---|
| Smoothing | Remove noise, handle outliers. | Binning, regression, clustering. |
| Attribute Construction | Create new attributes from existing ones. | Derive BMI from height and weight. |
| Aggregation | Summarize data (roll-up). | Daily sales → Monthly sales. |
| Generalization | Replace low-level values with higher-level concepts. | Age 23 → Young Adult. |
| Normalization | Scale attribute values to a small range. | Min-Max: $$\displaystyle x' = \frac{x - \min}{\max - \min} $$; Z-score: $$\displaystyle x' = \frac{x - \mu}{\sigma} $$. |
| Discretization/Binning | Convert continuous to discrete. | Equal-width binning: [0-10), [10-20), ... |
Handling Missing Values
Common in real-world data. Choice impacts model bias/variance.
| Method | Description | Implication |
|---|---|---|
| Ignore Tuple | Discard record with missing value. | Loses information; viable if few missing. |
| Fill with Constant | Replace with ?, 0, or user-defined. |
May create false patterns; treat as separate category. |
| Fill with Mean/Median/Mode | Use central tendency of attribute. | Simple, but distorts distribution/variance. |
| Use Global Constant | e.g., fill with -999. |
Similar to constant; may be treated as outlier. |
| Use Prediction/Regression | Predict missing value using other attributes. | More accurate; computationally expensive. |
[!TIP] Exam Pitfall: "Filling with mean" is not always best—it reduces variance and can bias correlations. Mention this trade-off.
III. DATA WAREHOUSING AND OLAP
OLAP Operations & Systems
OLAP enables multi-dimensional analysis of summarized data.
| Operation | Description | Analogy |
|---|---|---|
| Roll-up | Summarize data by climbing hierarchy (e.g., City → Country). | Zooming out. |
| Drill-down | Reverse of roll-up; view finer details. | Zooming in. |
| Slice-and-dice | Select a subset (slice) and project dimensions (dice). | Slicing a cube. |
| Pivot (Rotate) | Rotate axes to change perspective. | Turning a cube. |
OLAP System Types:
| Type | Storage | Performance | Scalability | Best For |
|---|---|---|---|---|
| MOLAP | Proprietary multidimensional array. | Fast query response. | Poor (pre-aggregation limits size). | Dense, stable data. |
| ROLAP | Relational DBMS (star/snowflake schema). | Slower (SQL joins). | Excellent (handles large data). | Large, sparse data. |
| HOLAP | Hybrid (aggregates in MOLAP, detail in ROLAP). | Balanced. | Moderate. | Mixed workloads. |
Snowflake Schema Design
A normalized variant of star schema where dimension tables are normalized into multiple related tables.
Case Study: University Data Warehouse
-
Fact Table:
Enrollment_Fact(Keys:student_key,course_key,semester_key,instructor_key; Measures:count,avg_grade) -
Dimensions:
-
Student (PK:
student_key) → Normalized intoStudent(details) andDepartment(dept_id). -
Course (PK:
course_key) → Normalized intoCourseandDepartment. -
Semester (PK:
semester_key) → Normalized intoSemesterandYear. -
Instructor (PK:
instructor_key) → Normalized intoInstructorandDepartment.
-
Conceptual Levels of Aggregation:
Base Level:
avg_grade= actual grade for (Student, Course, Semester, Instructor).
Higher Levels:
avg_grade= average grade for (Course, Semester) or (Department, Year), etc.
[!DIAGRAM]
DiagramSNOWFLAKE SCHEMA: University data warehouse with snowflake schema showing normalized dimension tables for Student->Department, Course->Department, Semester->Year, Instructor->Department, connected to central fact table Enrollment_Fact
IV. ASSOCIATION ANALYSIS
Association Rules & Negative Correlation
Rule: X → Y (X and Y are disjoint item sets).
-
Support:
P(X ∪ Y)– proportion of transactions containing both. -
Confidence:
P(Y|X) = support(X ∪ Y) / support(X)– conditional probability.
Critical Insight: High support & confidence do NOT imply positive correlation.
Example:
Let
X = {Milk},Y = {Coke}.
Total transactions = 100.
support(X) = 70,support(Y) = 60,support(X∪Y) = 50.
Confidence = 50/70 ≈ 0.714 (high).
But:
P(Y) = 0.60,P(Y|X)=0.714→P(Y|X) > P(Y)suggests positive correlation?
Check:
P(X∪Y) = 0.50vsP(X)*P(Y) = 0.42. Since0.50 > 0.42, they are positively correlated.
For Negative Correlation: Need
P(X∪Y) < P(X)*P(Y).
Example:
X={Bread},Y={Diet Coke}. Ifsupport(X)=80,support(Y)=20,support(X∪Y)=10.
Then
P(X)*P(Y)=0.16,P(X∪Y)=0.10→ negatively correlated, yet ruleBread → Diet Cokecould have confidence10/80=0.125(above min. threshold) and support0.10(above min.). Thus, strong rules can be negatively correlated.
Apriori Algorithm & Proof
Prior Knowledge (Apriori Property):
All non-empty subsets of a frequent itemset must also be frequent.
Proof (by contradiction):
Let
Lbe a frequent itemset (support(L) ≥ min_sup).
Assume a subset
S ⊂ Lis not frequent (support(S) < min_sup).
Any transaction containing
Lmust also containS(sinceS ⊂ L).
Therefore,
support(L) ≤ support(S).
But
support(S) < min_supimpliessupport(L) < min_sup, contradicting thatLis frequent.
Hence, all subsets of a frequent itemset must be frequent.
\boxed{\text{If } L \text{ is frequent, then } \forall S \subset L, S \neq \emptyset, \text{ support}(S) \ge \text{min_sup}}
Apriori Algorithm Steps:
-
Initialize:
C₁= all 1-itemsets. Scan DB to find frequentL₁(support ≥ min_sup). -
Iterate (k=2,3,...):
-
Candidate Generation:
Cₖ=Lₖ₋₁⋈Lₖ₋₁(self-join), then prune any candidate with a (k-1)-subset not inLₖ₋₁(using Apriori property). -
Pruning: Scan DB, count support of
Cₖ. -
Frequent Itemsets:
Lₖ= {c ∈Cₖ| support(c) ≥ min_sup}.
-
-
Stop when
Lₖis empty. -
Generate Rules: From frequent itemsets
L, generate rulesX → Y(X∪Y=L) with confidence ≥ min_conf.
[!TIP] Exam Must-Know: Be able to generate candidates for
k=2fromL₁, and prune using subset property. The algorithm scans DB k times (once per level).
V. CLASSIFICATION
Decision Tree Pruning
Purpose: Combat overfitting (tree too complex, captures noise).
-
Pre-pruning (Early Stopping): Halt tree growth during induction.
-
Methods: Stop if split doesn't improve purity (e.g., info gain < threshold), limit tree depth, minimum samples per leaf.
-
Advantage: Computationally efficient.
-
Disadvantage: Myopic; may stop too early.
-
-
Post-pruning (Backward Pruning): Grow full tree, then remove branches.
-
Methods: Error rate pruning (use separate validation set), cost-complexity pruning.
-
Advantage: More robust; considers full tree.
-
Disadvantage: Computationally expensive.
-
Drawback of Separate Validation Set for Pruning:
-
Reduces Training Data Size: Data split into training, validation, test → smaller training set may lead to underfitting or higher variance in the induced tree.
-
Potential Bias: Validation set may not be perfectly representative of the full data distribution, leading to suboptimal pruning decisions.
-
Variance in Evaluation: Pruning decisions become sensitive to the specific validation set split, reducing stability.
[!TIP] Exam Answer Structure: 1) State purpose (overfitting). 2) Contrast pre vs post. 3) For drawback: mention data inefficiency and evaluation instability.
VI. CLUSTERING ANALYSIS
k-means Clustering
Goal: Partition n objects into k clusters minimizing within-cluster sum of squares (WCSS).
Algorithm:
-
Initialize: Choose
kinitial centroids (randomly or by heuristic). -
Repeat until convergence:
-
Assignment Step: Assign each point to nearest centroid (using Euclidean distance).
-
Update Step: Recompute centroids as mean of assigned points.
-
-
Output: Cluster assignments.
Numerical Example (k=2):
Data: {(1,1), (1,2), (2,1), (5,5), (6,5), (5,6)}
Init centroids: c1=(1,1), c2=(5,5).
Iteration 1 Assignment:
Cluster1: {(1,1),(1,2),(2,1)}; Cluster2: {(5,5),(6,5),(5,6)}.
Update: c1_new = ((1+1+2)/3, (1+2+1)/3) = (1.33, 1.33); c2_new = ((5+6+5)/3, (5+5+6)/3) = (5.33, 5.33).
Repeat until centroids stabilize.
Limitation (Local Optimum):
k-means is sensitive to initial centroids and may converge to a suboptimal partition (local minimum of WCSS).
Example: With k=2 and data in three dense groups, bad initialization may merge two groups into one cluster, yielding higher WCSS than the global optimum.
\boxed{\text{WCSS} = \sum_{i=1}^{k} \sum_{\mathbf{x} \in C_i} |\mathbf{x} - \boldsymbol{\mu}_i|^2}
where $$\displaystyle \boldsymbol{\mu}_i $$ is centroid of cluster $$\displaystyle C_i $$.
Clustering for Multi-Granularity Outlier Detection
Clusters form a hierarchy (e.g., via hierarchical clustering or running k-means with varying k). Outliers can exist at different granularities:
-
Global Outliers: Far from all clusters (detected at coarse granularity).
-
Local Outliers: In sparse regions near a cluster (detected at finer granularity).
-
Collective Outliers: A small group of points forming a micro-cluster (detected as outlier cluster at some level).
Method:
-
Build clustering hierarchy (e.g., by repeatedly clustering clusters or using density-based clustering like DBSCAN with varying
eps). -
At each level, identify points with low density or far from cluster centroids.
-
Points flagged as outliers at multiple levels are strong candidates.
-
Advantage: Captures outliers relative to their local context, not just global density.
VII. OUTLIER DETECTION (ADVANCED)
Semi-Supervised Outlier Detection
Scenario: Training data has few labeled outliers and many unlabeled objects (which may be normal or outliers).
Advantage of Using Unlabeled Objects:
-
Better Model of Normal Behavior: Unlabeled data (mostly normal) provides a richer, more representative sample of the normal class distribution. This helps in building a more accurate boundary between normal and outlier.
-
Reduces Bias: With only few labeled outliers, a purely supervised model may overfit to those specific outlier patterns. Unlabeled data acts as a regularizer, forcing the model to learn the dominant normal patterns more robustly.
-
Semi-supervised frameworks (e.g., using EM, self-training, or positive-unlabeled learning) leverage unlabeled data to refine the decision boundary by assuming most unlabeled data are normal, thus improving detection accuracy for unseen outliers.
Example: In fraud detection, only a tiny fraction of transactions are labeled fraud. Using millions of unlabeled (mostly legitimate) transactions helps model "normal" spending patterns better, making anomalous fraud more detectable.
VIII. SPECIALIZED DATA MINING TYPES
Web Mining
Application of data mining techniques to web data.
| Type | Data Source | Goal | Techniques |
|---|---|---|---|
| Web Content Mining | Web page contents (text, images, audio). | Discover useful information/knowledge from page content. | Text mining, image analysis, semantic web. |
| Web Structure Mining | Hyperlinks between pages. | Discover site structure, page importance, communities. | Graph mining, PageRank, HITS. |
| Web Usage Mining | Server logs, user sessions. | Understand user behavior, personalize sites. | Session clustering, association rules on pageviews. |
Spatial and Temporal Data Mining
| Type | Definition | Example |
|---|---|---|
| Spatial Mining | Mining patterns from geographic/space-related data (points, polygons, raster). | Finding disease clusters (e.g., cholera cases near a pump), identifying high-crime zones, land-use classification from satellite images. |
| Temporal Mining | Mining patterns from time-related data (time series, sequential data). | Stock trend analysis, sales forecasting (seasonality), predicting equipment failure from sensor time-series, analyzing click-stream patterns over time. |
[!TIP] Distinguish: Spatial = where (geography); Temporal = when (time). Often combined (spatio-temporal).
IX. SOCIAL AND ETHICAL ISSUES
Security and Privacy Issues in Data Mining
| Issue | Description | Example |
|---|---|---|
| Data Misuse | Using data for purposes other than originally consented. | Selling customer purchase data to third parties without consent. |
| Inference Attacks | Sensitive information deduced from non-sensitive data via mining. | From purchase history (non-sensitive), inferring medical condition (sensitive) or sexual orientation. |
| Privacy Invasion | Profiling individuals without knowledge, leading to discrimination. | Credit scoring based on zip code (proxy for race), targeted advertising based on private browsing. |
| Threat to Democracy | Micro-targeting in politics, manipulation via personalized misinformation. | Cambridge Analytica-style voter profiling. |
Potential Countermeasures:
-
Technical: Anonymization (k-anonymity, l-diversity), Differential Privacy, Encryption, Secure Multi-party Computation.
-
Policy/Legal: Informed consent, data ownership rights (GDPR, CCPA), audit trails, ethical guidelines for data scientists.
-
Organizational: Privacy-by-design, data governance frameworks, transparency reports.
Ethical Principle: Beneficence (do good) vs Non-maleficence (do no harm). Mining should benefit society without causing unjust harm or discrimination.