Knowledge / Computer Applications / Data mining and knowledge discovery

Data mining and knowledge discovery

Computer Applications (MCA) · Mobile, cloud and data · free study notes for exams, placements and interviews

In short

Data mining is the extraction of previously unknown, valid and useful patterns from large volumes of data; knowledge discovery in databases (KDD) is the wider nine-step process - selection, preprocessing, transformation, mining, evaluation and presentation - in which mining is only one step. It answers questions a query cannot: which items are bought together, which customer will churn, which transaction is fraudulent, which patients group together. MCA syllabi examine it as a full paper (KDD steps, Apriori with support/confidence tables, decision trees with entropy and information gain, k-means iterations, Bayes classification), and GATE/UGC-NET ask the same numerics. Indian employers use it directly - credit scoring at HDFC and Bajaj Finserv, recommendation at Flipkart and Myntra, fraud analytics on UPI at NPCI, churn models at Jio and Airtel, and UIDAI/GSTN analytics - with personal-data handling now governed by the DPDP Act, 2023.

Explained

What data mining is, and what it is not

The KDD process, step by step

  1. Domain understanding and goal setting - state the business question (reduce churn by 5%).
  2. Data selection - choose target data set, tables, attributes, rows, time window.
  3. Data cleaning - handle missing values (ignore tuple, fill mean/median/mode, predict), smooth noise (binning, regression), remove duplicates, correct inconsistencies.
  4. Data integration - merge multiple sources; resolve schema conflicts, entity identification (cust_id vs customer_no) and redundancy (correlation / chi-square test).
  5. Data transformation - normalisation, aggregation, generalisation (concept hierarchy: city → state → zone), attribute construction (ratio of credit used), discretisation (binning age into bands).
  6. Data reduction - dimensionality reduction (PCA, attribute subset selection), numerosity reduction (sampling, clustering, histograms), data-cube aggregation, compression.
  7. Data mining - choose the task and algorithm, fit the model.
  8. Pattern evaluation - keep only interesting patterns using thresholds and measures.
  9. Knowledge presentation - visualisation, rules, dashboards, deployment into a scoring system.
  10. Rule of thumb: steps 2-6 (preprocessing) consume roughly 60-80% of project effort. Garbage in, garbage out.
  11. CRISP-DM is the industry counterpart: business understanding → data understanding → data preparation → modelling → evaluation → deployment, drawn as a cycle. SEMMA (SAS) = Sample, Explore, Modify, Model, Assess.

Data preprocessing in detail

Association rule mining

Classification and prediction

Clustering and outlier detection

Advanced mining, limitations and the Indian legal frame

Key points

Formulas and examples

Support(X) = count(X) / |D| (fraction, 0-1 or %); |D| = number of transactions
Confidence(X ⇒ Y) = Support(X ∪ Y) / Support(X) = P(Y|X)
Lift(X ⇒ Y) = Confidence(X ⇒ Y) / Support(Y) = P(X ∩ Y)/(P(X)·P(Y))
Entropy: Info(D) = − Σ pi log2(pi), i = 1..m classes; pi = fraction of class i (bits)
Info_A(D) = Σ (|Dj|/|D|) × Info(Dj); Gain(A) = Info(D) − Info_A(D)
SplitInfo_A(D) = − Σ (|Dj|/|D|) log2(|Dj|/|D|); GainRatio(A) = Gain(A)/SplitInfo_A(D)
Gini(D) = 1 − Σ pi²; Gini_A(D) = Σ (|Dj|/|D|) Gini(Dj); ΔGini = Gini(D) − Gini_A(D)
Bayes: P(Ci|X) = P(X|Ci)·P(Ci) / P(X); Naive: P(X|Ci) = Π P(xk|Ci)
Laplace: P(xk|Ci) = (count + 1)/(Ni + v), v = number of distinct values of that attribute
Min-max: v' = (v − min)/(max − min) × (new_max − new_min) + new_min; z-score: v' = (v − μ)/σ
Euclidean d = √Σ(xi − yi)²; Manhattan d = Σ|xi − yi|; Minkowski d = (Σ|xi − yi|p)1/p
SSE = Σclusters Σpoints ||x − ci||² (ci = centroid)
Accuracy = (TP+TN)/(TP+TN+FP+FN); Precision = TP/(TP+FP); Recall = TP/(TP+FN)
F1 = 2·Precision·Recall/(Precision+Recall); Specificity = TN/(TN+FP)
TF-IDF(t,d) = tf(t,d) × log(N/df(t)); N = number of documents, df = documents containing t

Example 1 - Apriori on 5 transactions (min_sup = 40%, min_conf = 70%)

TIDItems
T1Bread, Milk
T2Bread, Butter, Eggs
T3Milk, Butter, Eggs
T4Bread, Milk, Butter
T5Bread, Milk, Eggs

Example 2 - Decision tree split by information gain (14 tuples)

Class distribution: 9 "Buy = yes", 5 "Buy = no".

Example 3 - k-means, one full iteration (1-D data)

Points: 2, 4, 10, 12, 3, 20, 30, 11, 25. k = 2, initial centroids c1 = 2, c2 = 4.

Example 4 - Confusion matrix for a fraud model (10,000 UPI transactions, 100 actually fraudulent)

Predicted fraudPredicted genuine
Actually fraudTP = 70FN = 30
Actually genuineFP = 230TN = 9,670

Example 5 - Naive Bayes with Laplace smoothing

Training: 100 SMS, 40 spam and 60 ham. The word "lottery" appears in 12 spam and 1 ham; "offer" in 20 spam and 6 ham.

AspectAprioriFP-growth
Candidate generationYes, join and pruneNone
Database scansk+1 for k-itemsets2
Data structureHash tree of candidatesFP-tree (prefix tree)
MemoryLow per scan, huge candidate setsTree must fit in memory
Speed at low min_supPoorMuch better
Aspectk-meansHierarchical (agglomerative)DBSCAN
k requiredYesNo (cut dendrogram)No
Cluster shapeSpherical, similar sizeDepends on linkageArbitrary
OutliersDistort centroidsAppear as singletonsLabelled as noise
ComplexityO(nktd)O(n² log n) to O(n³)O(n log n) with index
Parametersk, seedslinkage, cut heightε, MinPts

Where it is used

Interview questions

Common mistakes

Related topics

Data warehousing and ETL · Machine learning workflow · Database management systems and SQL · Big data analytics with Hadoop and Spark · Statistics and probability for data science · Information security fundamentals

Open in the Knowledge reader →Find jobs →