Enhancing PPT Engagement in Data Mining
Enhancing PPT Engagement in Data Mining
UNIT - 1
Why Data mining? What is Data mining ?
Kinds of data meant for mining
Kinds of patterns that can be mined
Applications suitable for data mining
Issues in Data mining
Data objects and Attribute types
Statistical descriptions of data
Need for data preprocessing and data quality
Data cleaning
Data integration
Data reduction
Data transformation
Data cube and its usage
Why Data mining?
3
What is Data mining ?
Alternative names
• Knowledge discovery (mining) in databases (KDD), knowledge extraction,
data/pattern analysis, data archeology, data dredging, information
harvesting, business intelligence, etc.
4
Knowledge discovery process
Data processing
1. Data cleaning (remove noise and inconsistent data)
2. Data integration (multiple data sources maybe
combined)
3. Data selection (data relevant to the analysis task
are retrieved from database)
4. Data transformation (data transformed or
consolidated into forms appropriate for mining)
(Done with data preprocessing-standardizing formats)
5. Data mining (an essential process where intelligent
methods are applied to extract data patterns)
6. Pattern evaluation (identify the truly interesting
patterns)
7. Knowledge presentation (mined knowledge is
presented to the user with visualization or
representation techniques)
5
Try me…
[Link]
6
What Kind of Data Can Be mined?
• Database-oriented data sets and applications
• Relational database, data warehouse, transactional database
• Advanced data sets and advanced applications.
• Object-Relational Databases
• Temporal Databases, Sequence Databases, Time-Series databases
• Spatial Databases and Spatiotemporal Databases
• Text databases and Multimedia databases
• Heterogeneous Databases and Legacy Databases
• Data Streams
• The World-Wide Web
7
Relational Databases
• DBMS – database management system,
contains a collection of
interrelated data’s from databases.
• Each table contains set of
attributes(columns) and set of tuples(rows),
with columns as attributes of data and rows
as records.
• Tables can be used to represent the
relationships between or among multiple
tables.
• Each tuple in the relational table represents
an object identified by a unique key and
described by a set of attribute values.
• Relational data can be accessed by database
queries (SQL).
8
Data Warehouses
•A repository of information
collected from multiple sources,
stored under a unified schema, and
that usually resides at a single site.
9
Transactional Databases
• Consists of a file where each record
represents a transaction.
11
Temporal Databases, Sequence Databases, and Time-
Series Databases
• A temporal database typically stores relational
data that include time-related attributes.
12
Spatial Databases and Spatiotemporal Databases
• A spatial database that stores spatial objects that change with time
is called a spatiotemporal database.
13
Text Databases and Multimedia Databases
• Text databases are databases that
contain word descriptions for objects.
E.g.: product specifications, error or bug reports,
warning messages etc.
14
Heterogeneous Databases and Legacy Databases
15
Data Streams
• Many applications involve the generation and
analysis of a new kind of data, called stream data.
• where data flow in and out of an observation
platform (or window) dynamically.
Unique features
• huge or possibly infinite volume.
• dynamically changing.
• flowing in and out in a fixed order.
• allowing only one or a small number of scans.
• demanding fast (often real-time) response time.
Data characterization
• summarizing the general characteristics of a target class of data.
E.g. summarizing the characteristics of customers who spend more than $1,000 a
year at AllElectronics.
Data Discrimination
• comparing the target class with one or a set of comparative classes.
• E.g. Compare the general features of software products whole sales increase by
10% in the last year with those whose sales decrease by 30% during the same
period
19
Mining Frequent Patterns, Associations and Correlations
• Frequent itemset: a set of items that frequently appear together in a transactional data
set. (e.g. milk and bread)
20
Classification and Prediction
Classification
• The process of finding a model that describes and
distinguishes the data classes or concepts, for the
purpose of being able to use the model to predict
the class of objects whose class label is unknown.
Prediction
• Predict missing or unavailable numerical data
values.
21
• Classification (Predicts a
category)
• Categorical (discrete, unordered)
labels,
• Regression(Predicts a
numerical value)
• Models continuous-valued functions
22
Cluster Analysis
23
Outlier Analysis & Evolution Analysis
Outlier Analysis
• Data that do no comply with the general behavior or
model.
• Outliers are usually discarded as noise or exceptions.
• Useful for fraud detection.
E.g. Detect purchases of extremely large amounts
Evolution Analysis
• Describes and models regularities or trends for objects
whose
behavior changes over time.
E.g. Identify stock evolution regularities for overall
stocks and for the stocks of
particular companies.
24
Try me…
[Link]
25
Applications Suitable for data Mining
• Highly application-driven
discipline
26
Business Intelligence
• Business intelligence (BI)
technologies provide historical,
current, and predictive views of
business operations.
27
A typical DM System Architecture
• Data mining is the process of discovering interesting
knowledge from large amounts of data stored in databases,
data warehouses or other important repositories.
29
Issues in Data Mining
• Mining methodology and User interaction
Mining different kinds of knowledge
• DM should cover a wide spectrum of data analysis and knowledge discovery tasks
• Enable to use the database in different ways
• Require the development of numerous data mining techniques
33
Data Objects and Attribute Types
• A data object represents an entity.
E.g.: 1. Sales database - customers, store items, sales
2. Medical database - patients
[Link] database -students, professors,
courses.
• Data sets are made up of data objects.
35
Types Of Attributes
• Nominal
• Binary
• Ordinal
• Numeric
• Discrete
• Continuous
36
Nominal Attributes
• Nominal means “relating to names.”
37
Binary Attributes
• Two categories or states: 0 or 1
0 – absent
1 – present
• Binary attributes are referred to as Boolean if
the two states correspond to true and false.
Symmetric
• Both states are equally valuable and carry same
weight.
E.g.: Gender – Male & Female
Asymmetric
• Both states are not equally important
• rarest one, by 1 (e.g., Covid19 positive)
• other by 0 (e.g., Covid19 negative).
38
Ordinal Attribute
• An ordinal attribute is an attribute with
possible values that have a meaningful order
or ranking among them, but the magnitude
between successive values is not known.
• Order is important
E.g.: Grades {O, A+, A, B+, B, C}
professional rank {professors, associate,
assistant}
• Ordinal attributes are often used in surveys
for ratings.
39
Interval-Scaled Variables
• Interval-scaled attributes are measured on a scale
of equal-size units.
40
Ratio Scaled Attribute
• A ratio-scaled attribute is a numeric attribute with
an inherent zero-point.
41
Discrete versus Continuous Attributes
• A discrete attribute has a finite or countably infinite set of
values, which may or may not be represented as integers.
42
[Link]
nd
43
Statistical Descriptions of Data
• Statistical descriptions can be used to identify
properties of the data and highlight which data
values should be treated as noise or outliers.
44
Weighted arithmetic mean
• Some cases each value of xi in a set may be associated with a weight wi for i =
1,...,N.
45
Drawbacks of Mean Calculation
• Sensitive to extreme values.
• Even a small number of extreme values can corrupt the mean
E.g.: The mean salary at a company may be substantially pushed
up by that of a few highly paid managers.
Solution
• Trimmed mean
• Mean obtained after chopping off values at the high and low extremes.
• Sort the values observed for salary
• Remove the top and bottom 2% before computing the mean
46
Median
• Middle value in a set of ordered data values.
• It is the value that separates the higher half
of a data set from the lower half.
If N is odd
• Then the median is the middle value of
the ordered set.
If N is even
• Then the median is not unique
• It is the two middlemost values and any
value in between.
• The median is expensive to compute when
we have a large number of observations.
47
Mode
• The mode - value that occurs most frequently in the
set.
49
Range, Quartiles, Outliers and Boxplots
• The range of the set is the difference between the
largest (max()) and smallest (min()) values.
Boxplots
• Boxplots are a popular way of visualizing a
distribution. A boxplot incorporates the five-number
summary as follows:
✔ Typically, the ends of the box are at the quartiles so
that the box length is the interquartile range.
✔ The median is marked by a line within the box.
✔ Two lines (called whiskers) outside the box extend
to the smallest (Minimum) and largest (Maximum)
observations.
51
Five-Number Summary, Boxplots
52
Outliers
Outliers stand for data points that are indicative of a much higher variability than other
observations in a given dataset.
This can result in skewing statistical studies and wrong conclusions after all the
variables are not adequately identified and handled.
Identifications of outliers are very relevant for the financial sector, healthcare industry
and decision-making processes that depend on data analysis.
A common rule of thumb for identifying suspected outliers is to single out values
falling at least 1.5 × IQR above the third quartile or below the first quartile.
53
Outliers Example
54
Try…
[Link]
nd
55
Variance and Standard Deviation
•
56
Graphic Displays
• Graphic displays include quantile plots, quantile–
Quantile Plot quantile plots, histograms, and scatter plots.
Quantile Plot
• A quantile plot is a simple and effective way to look at
a univariate data distribution. First, it displays all of
the data for the given attribute. Second, It plots
quantile information.
Quantile–Quantile Plot
Quantile–Quantile Plot
• A quantile–quantile plot, or q-q plot, graphs the
quantiles of one univariate distribution against the
corresponding quantiles of another
57
Graphic Displays
Histograms
• “Histos” means pole, and “gram” means chart, so a
histogram is a chart of poles.
• If X is nominal, such as automobile model or item type,
then a pole or vertical bar is drawn for each known value
of X.
• The resulting graph is more commonly known as a bar
chart.
• If X is numeric, the term histogram is preferred.
• The range of values for X is partitioned into disjoint
consecutive subranges. The subranges, referred to as
buckets or bins. The range of a bucket is known as the
width.
58
Graphic Displays
Positive Correlation Negative Correlation
• A scatter plot is one of the most effective
graphical methods for determining if there
appears to be a relationship, pattern, or trend
between two numeric attributes.
59
Need for data preprocessing and data quality
60
Data Cleaning
Real-world data
✔ Incomplete
✔ Noisy
✔ Inconsistent
61
Handle Missing Values
1. Ignore the tuple 4. Use a measure of central tendency for the
✔ usually done when the class label is attribute (mean or median) to fill in
missing. missing value.
✔ This method is not very effective, unless
5. Use the attribute mean or median for all
the tuple contains several attributes with
samples belonging to the same class as the
missing values.
given tuple.
2. Fill in the missing value manually 6. Use the most probable value to fill in the
✔ Time consuming missing value
✔ May not be feasible given a large data set
with many missing values
64
Binning – Equal width (distance)
• Sorted data is given in the order - 5,10,11,13,15,35,50,55,72,92,204,215
65
Noisy Data
Regression
• Linear regression - finding the “best” line to fit two attributes (or variables) so that one
attribute can be used to predict the other.
• Multiple linear regression - is an extension of linear regression, where more than two
attributes are involved, and the data are fit to a multidimensional surface.
Outlier analysis
• Outliers may be detected by clustering, for example, where similar values are organized into
groups, or “clusters.”
66
Data Cleaning as process
• Missing values, noise, and inconsistencies contribute to inaccurate data.
• The first step in data cleaning as a process is discrepancy detection.
Factors causes Discrepancies
✔ Poorly designed data entry forms
✔ Human error in data entry, deliberate errors
✔ Data decay
Rules
• Unique Rule - Each value of the given attribute must be different from all other values
for that attribute.
• Consecutive Rule - There can be no missing values between the lowest and highest
values for the attribute, and that all values must also be unique (e.g., check numbers).
• Null Rule - Use of blanks, question marks, special characters, or other strings that may
indicate the null condition.
67
Data Cleaning as process
Field overloading
• Another source of errors that typically results when developers squeeze new attribute
definitions into unused (bit) portions of already defined attributes.
• Data auditing tools - find discrepancies by analyzing the data to discover rules and
relationships and detecting data that violate such conditions.
68
Give a try…
[Link]
69
Data Integration
Data integration
• Combines data from multiple sources into a coherent store
• Schema integration: e.g., [Link]-id = [Link]-#
• Integrate metadata from different sources
70
Handling Redundancy in Data Integration
• Redundant data occur often when integration of multiple databases.
✔ Object identification: The same attribute or object may have different names in
different databases.
✔ Derivable data: One attribute may be a “derived” attribute in another table, e.g., annual
revenue.
• Careful integration of the data from multiple sources may help reduce/avoid redundancies
and inconsistencies and improve mining speed and quality.
71
Data Integration
• For numerical attributes, we can evaluate the correlation between two attributes,
A and B, by computing the correlation coefficient.
• If rA,B > 0, A and B are positively correlated (A’s values increase as B’s). The higher,
the stronger correlation.
• rA,B = 0: uncorrelated;
• where oij is the observed frequency (i.e., actual count) of the joint event
(Ai;Bj) and eij is the expected frequency of (Ai;Bj), which can be computed as
73
Chi-Square Calculation Example
74
Data Transformation
• Smoothing: which works to remove noise from the data. Such techniques include binning,
regression, and clustering.
• Generalization of the data, where low-level or “primitive” (raw) data are replaced by higher-
level concepts through the use of concept hierarchies.
Eg: categorical attributes, like street, can be generalized to higher-level concepts, like
city or country.
• Numerical attributes, like age, may be mapped to higher-level concepts, like youth, middle-
aged, and senior.
75
Data Transformation
• Normalization: where the attribute data are scaled so as to fall within a small specified
range, such as - 1.0 to 1.0, or 0.0 to 1.0.
• Attribute construction (or feature construction),where new attributes are constructed and
added from the given set of attributes to help the mining process.
76
Min-max normalization
• Min-max normalization preserves the relationships among the original data values.
Example
• Suppose that the minimum and maximum values for the attribute income are
$12,000 and $98,000, respectively. We would like to map income to the range
[0.0;1.0]. By min-max normalization, a value of $73,600 for income is transformed.
77
z-score normalization (or zero-mean normalization)
• The values for an attribute, A, are normalized based on the mean and standard
deviation of A.
• Where Ᾱ and σA are the mean and standard deviation, respectively, of attribute A.
Example
• Suppose that the mean and standard deviation of the values for the attribute income
are $54,000 and $16,000, respectively. With z-score normalization, a value of
$73,600 for income is transformed
78
Normalization by decimal scaling
• Normalizes by moving the decimal point of values of attribute A. The number of decimal
points moved depends on the maximum absolute value of A.
• Suppose that the recorded values of A range from - 986 to 917. The maximum absolute value
of A is 986.
• To normalize by decimal scaling, we therefore divide each value by 1,000 (i.e., j = 3) so that
- 986 normalizes to – 0.986 and 917 normalizes to 0.917.
79
Give a try…
[Link]
80
Data Reduction
• Data reduction techniques can be applied to obtain a reduced representation of the data set
that is much smaller in volume.
• closely maintains the integrity of the original data.
Strategies for data reduction
✔ Data cube aggregation: where aggregation operations are applied to the data in the
construction of a data cube.
✔ Attribute subset selection: where irrelevant, weakly relevant, or redundant attributes or
dimensions may be detected and removed.
✔ Dimensionality reduction: where encoding mechanisms are used to reduce the data set
size.
✔ Numerosity reduction: where the data are replaced or estimated by alternative.
✔ Discretization and concept hierarchy generation: where raw data values for attributes are
replaced by ranges or higher conceptual levels.
81
Data cube and its usage
Data Cube
Data Cube Aggregation
82
Attribute Subset Selection
83