What is Data Mining? Meaning, Uses, Techniques and Examples
Article

What is Data Mining? Meaning, Uses, Techniques and Examples

In this post
  1. What is Data Mining?
  2. Data Mining vs Data Analysis, Machine Learning and Data Science
  3. Types of Data in Data Mining
  4. Types of Data Mining: Descriptive and Predictive
  5. Four Techniques With Worked Examples
  6. 1. Association rules: what is bought together
  7. 2. Clustering: group customers without labels
  8. 3. Classification: learn a rule from labelled cases
  9. 4. Anomaly detection: find the value that does not fit
  10. The Data Mining Process in Six Stages
  11. Where Data Mining is Used?
  12. Tools Used for Data Mining
  13. Data Mining Limits, Privacy and Ethics
  14. How to Start Learning Data Mining?

Every shop, bank, hospital and website now stores more data than anyone can read. A supermarket records every bill. A phone company records every call. A website records every click. The records on their own say little. The useful part is what hides inside them: which products sell together, which customers are about to leave, which transaction looks wrong. What is data mining is a common first question for anyone starting in data science, and the short answer is this: data mining is the process of finding useful patterns in large sets of data, using statistics and machine learning.

This guide explains the idea in plain words and then shows it working. You will see the meaning of data mining, how it differs from data analysis and machine learning, the main types of data mining and types of data in data mining, and the six stages of a data mining project. Most guides stop at definitions. Here, each of the four main techniques (association rules, clustering, classification and anomaly detection) has a small example you can check by hand with code that was run and the real output shown. We also cover a topic many pages skip: the privacy and consent rules that apply when you mine data about people.

The term itself can confuse. You do not mine data the way you mine coal. Nothing is dug out. What you extract is knowledge from the data, which is why the older name is knowledge discovery in databases, or KDD. IBM describes data mining as using machine learning and statistical analysis to uncover patterns and other valuable information from large data sets, and notes that it is also known as KDD. We use that definition throughout this post. If you are new to the wider field, read our data science tutorial for beginners on prwatech.in first, then come back here.

What is Data Mining?

Data mining is the work of searching a large data set for patterns that are valid, new, useful and understandable. A pattern is any repeatable relationship in the data: two products that appear in the same basket, a group of customers who behave alike, a combination of factors that comes before a cancelled order.

Three ideas sit inside that definition:

  • Large data. Patterns in a few rows are easy to see by eye. Mining matters when the data is too big for that.
  • Patterns, not single facts. Looking up one customer is a query. Finding that customers who complain twice leave soon after is a pattern.
  • Useful. A pattern that cannot change a decision has no value. This is why a project starts with a business question and not with the data.

Data Mining vs Data Analysis, Machine Learning and Data Science

These four terms overlap, and people use them loosely. The table shows how they usually differ. It is a working guide and not a strict rule, because the boundaries move between companies.

Data analysis, data mining, machine learning and data science compared
Term Main question Typical output
Data analysis What happened, and why? Reports, charts and dashboards for known questions
Data mining What patterns are hidden in this data? Rules, groups, predictions and flagged cases found without a fixed question in advance
Machine learning How can a program learn from data to predict or decide? A trained model that makes predictions on new data
Data science How do we use data, statistics and code to solve a problem end to end? Models, analysis and recommendations, often delivered as a product or a report

The simplest way to hold it: data mining is the discovery step, machine learning supplies many of the algorithms used in it, and data science is the larger job that includes both. If you want to learn the skills that sit around data mining, such as SQL, Excel and a reporting tool, the Prwatech data analyst skills guide (link when live) lists them.

Types of Data in Data Mining

Data mining works on many kinds of data. The kind of data decides which techniques you can use.

Common types of data and a question each one answers
Type of data What it looks like Example question
Relational (table) data Rows and columns in a database or spreadsheet Which customers have a high bill and few visits?
Transactional data One record per purchase or event, with a list of items Which items are bought together?
Time series data Values recorded over time Do daily orders follow a weekly pattern, and which day broke it?
Text data Reviews, emails, support tickets What do unhappy customers write about most?
Web and log data Clicks, page visits, server logs Which pages do visitors view before they leave?
Spatial data Locations and maps Where do deliveries fail most often?

Most beginner projects use the first two types, and so do the examples below.

Types of Data Mining: Descriptive and Predictive

Data mining tasks fall into two broad groups.

  • Descriptive data mining describes what is in the data now. Clustering and association rules are descriptive. They answer questions such as which customers behave alike.
  • Predictive data mining uses past data to say something about new cases. Classification and regression are predictive. They answer questions such as whether a new customer is likely to leave.

Anomaly detection sits between the two. It describes what is normal and then flags what is not.

Data mining techniques grouped by purpose
Technique Group Needs labelled examples? Question it answers
Association rules Descriptive No What goes together?
Clustering Descriptive No Which records are alike?
Classification Predictive Yes Which category does this case belong to?
Regression Predictive Yes What number should we expect?
Anomaly detection Both Usually no Which record does not fit?

Four Techniques With Worked Examples

The examples use very small data so you can check every number yourself. Real projects use thousands or millions of rows, but the logic is the same. The code needs Python and the scikit learn library. The full file is data_mining_demo.py, sent with this post. We ran it on Python 3.13 and scikit learn 1.9, and every result shown below is its real output.

1. Association rules: what is bought together

Take ten shopping baskets. We want to know whether people who buy butter also buy bread. Three measures are used:

  • Support is the share of all baskets that contain both items.
  • Confidence is, among baskets with the first item, the share that also contain the second.
  • Lift is confidence divided by the share of all baskets with the second item. A lift of 1 means the two items are unrelated. A lift above 1 means they appear together more than chance would give.
python
baskets = [
    {"bread", "milk"}, {"bread", "butter", "milk"}, {"bread", "butter"},
    {"milk", "tea"}, {"bread", "milk", "tea"}, {"bread", "butter", "milk"},
    {"tea", "sugar"}, {"bread", "milk"}, {"milk", "sugar"}, {"bread", "butter", "tea"},
]
n = len(baskets)
def support(items):
    return sum(items <= b for b in baskets) / n

for a, b in [("butter", "bread"), ("bread", "milk"), ("tea", "sugar")]:
    s = support({a, b}); conf = s / support({a}); lift = conf / support({b})
    print(f"{a} -> {b}: support {s:.2f}, confidence {conf:.2f}, lift {lift:.2f}")
output
butter -> bread: support 0.40, confidence 1.00, lift 1.43
bread -> milk: support 0.50, confidence 0.71, lift 1.02
tea -> sugar: support 0.10, confidence 0.25, lift 1.25

Check by hand. Bread is in 7 of 10 baskets and butter is in 4. All 4 butter baskets also hold bread, so confidence is 4 out of 4, which is 1.00. Lift is 1.00 divided by 0.70, which is 1.43. For bread and milk, 5 baskets have both. Confidence is 5 out of 7, or 0.71, but lift is only 1.02. Bread and milk are both common, so they meet often by chance, and the rule tells you almost nothing. The third rule shows another trap. Tea and sugar have a lift of 1.25, but they appear together in only one basket. A rule with that little support is not worth acting on. This is why you read all three numbers and not just one.

2. Clustering: group customers without labels

Eight customers are described by visits per month and average bill. No one told the program who belongs where. K means clustering asks for a number of groups, then moves group centres until each customer sits with the nearest centre.

python
from sklearn.cluster import KMeans

customers = [[2, 300], [3, 350], [2, 280], [3, 320], [12, 900], [14, 950], [13, 880], [15, 1000]]
km = KMeans(n_clusters=2, n_init=10, random_state=0).fit(customers)
print(km.labels_)  # one group number per customer
output
[1 1 1 1 0 0 0 0]

Group summary printed by the full file:

output
4 customers, average 2.5 visits, average bill 312.5
4 customers, average 13.5 visits, average bill 932.5

The program found a light group (about 2.5 visits and a bill near 312) and a heavy group (about 13.5 visits and a bill near 932). A business could treat them differently, for example with a loyalty offer for the heavy group. In real data you must also choose the number of groups, and the answer is not always obvious. Try several values and check whether the groups make business sense. We also scale features before clustering when their units differ a lot, which these two columns do. We checked: scaling the two columns first gives the same groups here, but it matters on messier data.

3. Classification: learn a rule from labelled cases

Now we have ten past customers with a known outcome: 1 if they left, 0 if they stayed. The features are months as a customer and complaints in the last three months. A decision tree learns a rule from these examples.

python
from sklearn.tree import DecisionTreeClassifier, export_text

X = [[24, 0], [30, 1], [18, 0], [36, 0], [3, 3], [5, 2], [2, 4], [6, 3], [20, 1], [4, 2]]
y = [0, 0, 0, 0, 1, 1, 1, 1, 0, 1]
tree = DecisionTreeClassifier(max_depth=2, random_state=0).fit(X, y)
print(export_text(tree, feature_names=["months", "complaints"]))
print(tree.predict([[4, 3], [28, 0]]))
output
|--- complaints <= 1.50
|   |--- class: 0
|--- complaints >  1.50
|   |--- class: 1
[1 0]

The tree learned one simple rule: customers with more than 1.5 complaints (so 2 or more) left, and the rest stayed. It predicts that a customer with 4 months and 3 complaints will leave, and one with 28 months and 0 complaints will stay. Two cautions. First, this data is tiny and made for teaching, so the rule is clean. Real data is noisy, and a tree that fits the training data perfectly may fail on new customers. Always test on cases the model has not seen. Second, a prediction is a probability and not a fact. Treat it as a reason to look closer, not as a verdict.

4. Anomaly detection: find the value that does not fit

Here are twelve daily order values. One of them looks wrong. A common rule flags any value more than 1.5 times the interquartile range (IQR) below the first quartile or above the third quartile.

python
import statistics

orders = [210, 225, 198, 240, 215, 205, 230, 220, 1850, 212, 208, 235]
q1, _, q3 = statistics.quantiles(orders, n=4, method="inclusive")
iqr = q3 - q1; low, high = q1 - 1.5 * iqr, q3 + 1.5 * iqr
print(f"Q1 {q1:.2f}, Q3 {q3:.2f}, IQR {iqr:.2f}, fences {low:.2f} to {high:.2f}")
print([v for v in orders if v < low or v > high])
output
Q1 209.50, Q3 231.25, IQR 21.75, fences 176.88 to 263.88
[1850]

The value 1850 is far outside the range of 176.88 to 263.88, so it is flagged. A flag does not say what went wrong. It could be a data entry error, a bulk order or fraud. A person must check. Different quartile methods give slightly different fences, so note which one you used.

The Data Mining Process in Six Stages

Diagram of the six stages of a data mining project in a loop: business understanding, data understanding, data preparation, modelling, evaluation and deployment

A widely used process for data mining projects is CRISP DM, which has six stages. IBM describes a similar five step flow: set objectives, select data, prepare data, build models and mine patterns, then evaluate and implement.

The six stages of a data mining project and a common mistake at each
Stage What happens Common mistake
1. Business understanding Agree the question and what a good answer looks like Starting with data and no question
2. Data understanding Check what data exists, its quality and its gaps Assuming the data is complete
3. Data preparation Remove duplicates, fix missing values, join tables, pick features Skipping this stage, which usually takes the most time
4. Modelling Apply a technique such as clustering or classification Using a complex model when a simple one works
5. Evaluation Test on unseen data and ask if the result helps the business Trusting a model that was only tested on its own training data
6. Deployment Put the result to use and monitor it over time Treating the project as finished at launch

The claim that data preparation takes the most time is a common view among practitioners and appears in many guides. We did not find a single reliable figure, so we give no percentage.

Where Data Mining is Used?

Typical uses of data mining by area
Area Typical use Technique often used
Retail Find items bought together to plan shelves and offers Association rules
Banking and payments Flag transactions that look unusual for review Anomaly detection
Telecom and subscriptions Spot customers likely to cancel Classification
Marketing Group customers by behaviour Clustering
Manufacturing Detect faulty readings in sensor data Anomaly detection and time series analysis
Education Find students who may need extra support Classification

These are typical uses and not claims about any one company. The same four techniques show up across all of them, which is why learning the techniques is more useful than memorising sector lists.

Tools Used for Data Mining

  • Python with pandas for data handling and scikit learn for models. It is the most common choice for learners.
  • SQL to pull and prepare data from databases before mining.
  • Excel and Power BI for exploring data and showing results to non technical readers.
  • KNIME and Weka are free visual tools that let you build mining workflows without writing much code.
  • Apache Spark when the data is too big for one machine.

Data Mining Limits, Privacy and Ethics

Data mining finds patterns. It does not prove why they exist. Four limits are worth knowing:

  • Correlation is not cause. Customers who buy umbrellas may also buy raincoats because it rained, not because one causes the other.
  • Biased data gives biased results. If past decisions were unfair, a model trained on them will repeat the unfairness.
  • Overfitting. A model can memorise noise. Test on unseen data.
  • Rare events are hard. If only 1 in 1,000 transactions is fraud, a model that always says “not fraud” is 99.9 percent accurate and useless.

Privacy matters most when you mine data about people. In India, the Digital Personal Data Protection Act, 2023 sets rules for processing personal data. In the summary of the Bill published by PRS Legislative Research, personal data may be processed only for a lawful purpose after the person gives consent, a notice must say what data is collected and why, consent can be withdrawn, and data should be erased once its purpose is met, with listed exceptions. Companies that mine customer data should check their current obligations with a qualified adviser. This post is general information and not legal advice.

How to Start Learning Data Mining?

  • Learn Python basics first. Practise with small exercises, such as our Python practice guide (link when live).
  • Learn pandas to load, clean and summarise tables.
  • Do each technique once on a small data set. The four examples above are a good start. Change the numbers and see what moves.
  • Use a public data set and work through all six stages, including writing down the business question.
  • Write up one project in plain language. Explaining a result is part of the skill.

If you prefer guided learning with feedback, Prwatech runs a Data Analyst course in Bangalore and a Data Science course in Pune. Offline classes are held in Bangalore (BTM Layout) and Pune (Kharadi). Learners in other cities can join live online classes or study at their own pace. For the syllabus, batch dates and fees, please ask the Prwatech learning team through the demo class form below.

Learn about our Data Analyst Certification Course

Want to know more?

Explore our website or get in touch with our team for further information.

Call our Counselors ✆+91 8147111254