1 DATA MINING DATA MINING Source : Source : Margaret H. Dunham Margaret H. Dunham Department of Computer Science and Engineering Department of Computer Science and Engineering Southern Methodist University Southern Methodist University Companion slides for the text by Dr. M.H.Dunham, Companion slides for the text by Dr. M.H.Dunham, Data Mining, Data Mining, Introductory and Advanced Topics Introductory and Advanced Topics , Prentice Hall, 2002. , Prentice Hall, 2002.
DATA MINING. Source : Margaret H. Dunham Department of Computer Science and Engineering Southern Methodist University Companion slides for the text by Dr. M.H.Dunham, Data Mining, Introductory and Advanced Topics , Prentice Hall, 2002. Introduction Outline. - PowerPoint PPT Presentation
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
11
DATA MININGDATA MINING
Source :Source :Margaret H. DunhamMargaret H. Dunham
Department of Computer Science and EngineeringDepartment of Computer Science and EngineeringSouthern Methodist UniversitySouthern Methodist University
Companion slides for the text by Dr. M.H.Dunham, Companion slides for the text by Dr. M.H.Dunham, Data Mining, Data Mining, Introductory and Advanced TopicsIntroductory and Advanced Topics, Prentice Hall, 2002., Prentice Hall, 2002.
22
Introduction OutlineIntroduction Outline
• Define data miningDefine data mining• Data mining vs. databasesData mining vs. databases• Basic data mining tasksBasic data mining tasks• Data mining developmentData mining development• Data mining issuesData mining issues
Goal:Goal: Provide an overview of data mining. Provide an overview of data mining.
33
IntroductionIntroduction• Data is growing at a phenomenal Data is growing at a phenomenal
raterate• Users expect more sophisticated Users expect more sophisticated
• Finding hidden information in Finding hidden information in a databasea database
• Fit data to a modelFit data to a model• Similar termsSimilar terms
– Exploratory data analysisExploratory data analysis– Data driven discoveryData driven discovery– Deductive learningDeductive learning
55
Database Processing vs. Database Processing vs. Data Mining ProcessingData Mining Processing• QueryQuery
– Well definedWell defined– SQLSQL
• QueryQuery– Poorly definedPoorly defined– No precise query languageNo precise query language
DataData– Operational dataOperational data
OutputOutput– PrecisePrecise– Subset of databaseSubset of database
DataData– Not operational dataNot operational data
OutputOutput– FuzzyFuzzy– Not a subset of databaseNot a subset of database
66
Query ExamplesQuery Examples• DatabaseDatabase
• Data MiningData Mining
– Find all customers who have purchased milkFind all customers who have purchased milk
– Find all items which are frequently purchased Find all items which are frequently purchased with milk. (association rules)with milk. (association rules)
– Find all credit applicants with last name of Smith.Find all credit applicants with last name of Smith.– Identify customers who have purchased more Identify customers who have purchased more than $10,000 in the last month.than $10,000 in the last month.
– Find all credit applicants who are poor credit Find all credit applicants who are poor credit risks. (classification)risks. (classification)– Identify customers with similar buying habits. Identify customers with similar buying habits. (Clustering)(Clustering)
77
Data Mining Models and Data Mining Models and TasksTasks
88
Basic Data Mining TasksBasic Data Mining Tasks• Classification Classification maps data into predefined maps data into predefined
groups or classesgroups or classes– Supervised learningSupervised learning– Pattern recognitionPattern recognition– PredictionPrediction
• RegressionRegression is used to map a data item to a is used to map a data item to a real valued prediction variable.real valued prediction variable.
• Clustering Clustering groups similar data together into groups similar data together into clusters.clusters.– Unsupervised learningUnsupervised learning– SegmentationSegmentation– PartitioningPartitioning
99
Basic Data Mining Tasks Basic Data Mining Tasks (cont’d)(cont’d)• Summarization Summarization maps data into subsets maps data into subsets
with associated simple descriptions.with associated simple descriptions.– CharacterizationCharacterization– GeneralizationGeneralization
• Link AnalysisLink Analysis uncovers relationships uncovers relationships among data.among data.– Affinity AnalysisAffinity Analysis– Association RulesAssociation Rules– Sequential Analysis determines sequential Sequential Analysis determines sequential
patterns.patterns.
1010
Ex: Time Series AnalysisEx: Time Series Analysis• Example: Stock MarketExample: Stock Market• Predict future valuesPredict future values• Determine similar patterns over timeDetermine similar patterns over time• Classify behaviorClassify behavior
1111
Data Mining vs. KDDData Mining vs. KDD
• Knowledge Discovery in Knowledge Discovery in Databases (KDD):Databases (KDD): process of process of finding useful information and finding useful information and patterns in data.patterns in data.
• Data Mining:Data Mining: Use of algorithms to Use of algorithms to extract the information and patterns extract the information and patterns derived by the KDD process. derived by the KDD process.
1212
KDD ProcessKDD Process
• Selection:Selection: Obtain data from various Obtain data from various sources.sources.
• Preprocessing:Preprocessing: Cleanse data. Cleanse data.• Transformation:Transformation: Convert to common Convert to common
format. Transform to new format.format. Transform to new format.• Data Mining:Data Mining: Obtain desired results. Obtain desired results.• Interpretation/Evaluation:Interpretation/Evaluation: Present Present
results to user in meaningful manner.results to user in meaningful manner.
Modified from [FPSS96C]
1313
KDD Process Ex: Web LogKDD Process Ex: Web Log• Selection:Selection:
– Select log data (dates and locations) to useSelect log data (dates and locations) to use• Preprocessing:Preprocessing:
Social Implications of DMSocial Implications of DM• Privacy Privacy • ProfilingProfiling• Unauthorized useUnauthorized use
1818
Data Mining MetricsData Mining Metrics• UsefulnessUsefulness• Return on Investment (ROI)Return on Investment (ROI)• AccuracyAccuracy• Space/TimeSpace/Time
1919
Database Perspective on Database Perspective on Data MiningData Mining• ScalabilityScalability• Real World DataReal World Data• UpdatesUpdates• Ease of UseEase of Use
DM: Only imprecise queriesDM: Only imprecise queries
2323
Fuzzy Sets and LogicFuzzy Sets and Logic• Fuzzy Set:Fuzzy Set: Set membership function is a real Set membership function is a real
valued function with output in the range [0,1].valued function with output in the range [0,1].• f(x): Probability x is in F.f(x): Probability x is in F.• 1-f(x): Probability x is not in F.1-f(x): Probability x is not in F.• EX:EX:
– T = {x | x is a person and x is tall}T = {x | x is a person and x is tall}– Let f(x) be the probability that x is tallLet f(x) be the probability that x is tall– Here f is the membership functionHere f is the membership function
DM: DM: Prediction and classification are Prediction and classification are fuzzy.fuzzy.
2424
Fuzzy SetsFuzzy Sets
2525
Classification/Prediction is Classification/Prediction is FuzzyFuzzy
Loan
Amnt
Simple Fuzzy
Accept Accept
RejectReject
2626
Information Retrieval Information Retrieval • Information Retrieval (IR):Information Retrieval (IR): retrieving desired retrieving desired
information from textual data.information from textual data.• Library ScienceLibrary Science• Digital LibrariesDigital Libraries• Web Search EnginesWeb Search Engines• Traditionally keyword basedTraditionally keyword based• Sample query:Sample query:
Find all documents about “data mining”.Find all documents about “data mining”.
IR Query Result Measures IR Query Result Measures and Classificationand Classification
IR Classification
2828
Dimensional ModelingDimensional Modeling• View data in a hierarchical manner more as View data in a hierarchical manner more as
business executives mightbusiness executives might• Useful in decision support systems and Useful in decision support systems and
miningmining• Dimension:Dimension: collection of logically related collection of logically related
attributes; axis for modeling data.attributes; axis for modeling data.• Facts:Facts: data stored data stored• Ex: Dimensions – products, locations, dateEx: Dimensions – products, locations, date
Facts – quantity, unit priceFacts – quantity, unit price
DM: May view data as dimensional.DM: May view data as dimensional.
Dimensional Modeling Dimensional Modeling QueriesQueries•Roll Up:Roll Up: more general dimension more general dimension•Drill Down:Drill Down: more specific dimension more specific dimension• Dimension (Aggregation) HierarchyDimension (Aggregation) Hierarchy• SQL uses aggregationSQL uses aggregation•Decision Support Systems (DSS):Decision Support Systems (DSS):
Computer systems and tools to assist Computer systems and tools to assist managers in making decisions and managers in making decisions and solving problems.solving problems.
3131
Cube view of DataCube view of Data
3232
Aggregation Aggregation HierarchiesHierarchies
3333
Data WarehousingData Warehousing• ““Subject-oriented, integrated, time-variant, Subject-oriented, integrated, time-variant,
nonvolatile” William Inmonnonvolatile” William Inmon• Operational Data:Operational Data: Data used in day to day needs Data used in day to day needs
of company.of company.• Informational Data:Informational Data: Supports other functions such Supports other functions such
as planning and forecasting.as planning and forecasting.• Data mining tools often access data warehouses Data mining tools often access data warehouses
rather than operational data.rather than operational data.
DM: May access data in warehouse.DM: May access data in warehouse.
3434
Operational vs. Operational vs. InformationalInformational
Operational Data Data Warehouse
Application OLTP OLAPUse Precise Queries Ad HocTemporal Snapshot HistoricalModification Dynamic StaticOrientation Application BusinessData Operational Values IntegratedSize Gigabits TerabitsLevel Detailed SummarizedAccess Often Less OftenResponse Few Seconds MinutesData Schema Relational Star/Snowflake
more complex queries than OLTP.more complex queries than OLTP.• OnLine Transaction Processing (OLTP):OnLine Transaction Processing (OLTP):
traditional database/transaction processing.traditional database/transaction processing.• Dimensional data; cube view Dimensional data; cube view • Visualization of operations:Visualization of operations:
– Slice:Slice: examine sub-cube. examine sub-cube.– Dice:Dice: rotate cube to look at another dimension. rotate cube to look at another dimension.– Roll Up/Drill DownRoll Up/Drill Down
DM: May use OLAP queries.DM: May use OLAP queries.
3636
OLAP OperationsOLAP Operations
Single Cell Multiple Cells Slice Dice
Roll Up
Drill Down
3737
StatisticsStatistics• Simple descriptive modelsSimple descriptive models• Statistical inference:Statistical inference: generalizing a generalizing a
model created from a sample of the data model created from a sample of the data to the entire dataset.to the entire dataset.
• Exploratory Data Analysis:Exploratory Data Analysis: – Data can actually drive the creation of Data can actually drive the creation of
the modelthe model– Opposite of traditional statistical view.Opposite of traditional statistical view.
• Data mining targeted to business userData mining targeted to business user
DM: Many data mining methods DM: Many data mining methods come from statistical come from statistical techniques. techniques.
3838
Machine LearningMachine Learning• Machine Learning:Machine Learning: area of AI that examines how to area of AI that examines how to
write programs that can learn.write programs that can learn.• Often used in classification and prediction Often used in classification and prediction • Supervised Learning:Supervised Learning: learns by example. learns by example.• Unsupervised Learning: Unsupervised Learning: learns without knowledge learns without knowledge
of correct answers.of correct answers.• Machine learning often deals with small static datasets. Machine learning often deals with small static datasets.
DM: Uses many machine learning DM: Uses many machine learning techniques.techniques.
3939
Pattern Matching Pattern Matching (Recognition)(Recognition)•Pattern Matching:Pattern Matching: finds occurrences of finds occurrences of
a predefined pattern in the data.a predefined pattern in the data.• Applications include speech recognition, Applications include speech recognition,
information retrieval, time series information retrieval, time series analysis.analysis.
DM: Type of classification.DM: Type of classification.
4040
DM vs. Related TopicsDM vs. Related TopicsArea Query Data Result
s Output
DB/OLTP
Precise
Database Precise
DB Objects or Aggregation
IR Precise
Documents Vague Documents
OLAP Analysis
Multidimensional
Precise
DB Objects or Aggregation
DM Vague Preprocessed Vague KDD Objects
4141
Data Mining Techniques Data Mining Techniques OutlineOutline
• StatisticalStatistical– Point EstimationPoint Estimation– Models Based on SummarizationModels Based on Summarization– Bayes TheoremBayes Theorem– Hypothesis TestingHypothesis Testing– Regression and CorrelationRegression and Correlation
Goal:Goal: Provide an overview of basic data Provide an overview of basic data mining techniquesmining techniques
4242
Point EstimationPoint Estimation• Point Estimate:Point Estimate: estimate a population estimate a population
parameter.parameter.• May be made by calculating the May be made by calculating the
parameter for a sample.parameter for a sample.• May be used to predict value for missing May be used to predict value for missing
data.data.• Ex: Ex:
– R contains 100 employeesR contains 100 employees– 99 have salary information99 have salary information– Mean salary of these is $50,000Mean salary of these is $50,000– Use $50,000 as value of remaining Use $50,000 as value of remaining
employee’s salary. employee’s salary. Is this a good idea?Is this a good idea?
4343
Estimation ErrorEstimation Error• Bias: Bias: Difference between expected value and actual Difference between expected value and actual
value.value.
• Mean Squared Error (MSE):Mean Squared Error (MSE): expected value of the expected value of the squared difference between the estimate and the squared difference between the estimate and the actual value:actual value:
• Why square?Why square?• Root Mean Square Error (RMSE)Root Mean Square Error (RMSE)
• Solves estimation with incomplete data.Solves estimation with incomplete data.• Obtain initial estimates for parameters.Obtain initial estimates for parameters.• Iteratively use estimates for missing Iteratively use estimates for missing
data and continue until convergence.data and continue until convergence.
hh11=authorize purchase, h=authorize purchase, h2 2 = authorize after = authorize after further identification, hfurther identification, h33=do not authorize, =do not authorize, h h44= do not authorize but contact police= do not authorize but contact police
• Assign twelve data values for all Assign twelve data values for all combinations of credit and income:combinations of credit and income:
• From training data: P(hFrom training data: P(h11) = 60%; ) = 60%; P(hP(h22)=20%; P(h)=20%; P(h33)=10%; P(h)=10%; P(h44)=10%.)=10%.
1 2 3 4 Excellent x1 x2 x3 x4 Good x5 x6 x7 x8 Bad x9 x10 x11 x12
4949
Bayes Example(cont’d)Bayes Example(cont’d)• Training Data:Training Data:
ID Income Credit Class xi 1 4 Excellent h1 x4 2 3 Good h1 x7 3 2 Excellent h1 x2 4 3 Good h1 x7 5 4 Good h1 x8 6 2 Excellent h1 x2 7 3 Bad h2 x11 8 2 Bad h2 x10 9 3 Bad h3 x11 10 1 Bad h4 x9
5050
Bayes Bayes Example(cont’d)Example(cont’d)
• Calculate P(xCalculate P(xii|h|hjj) and P(x) and P(xii))• Ex: P(xEx: P(x77|h|h11)=2/6; P(x)=2/6; P(x44|h|h11)=1/6; P(x)=1/6; P(x22|h|h11)=2/6; )=2/6;
P(xP(x88|h|h11)=1/6; P(x)=1/6; P(xii|h|h11)=0 for all other x)=0 for all other xii..• Predict the class for xPredict the class for x44::
– Calculate P(hCalculate P(hjj|x|x44) for all h) for all hjj. . – Place xPlace x4 4 in class with largest value.in class with largest value.– Ex: Ex:
• Alternatively, distance measure measure Alternatively, distance measure measure how unlike or dissimilar objects are.how unlike or dissimilar objects are.
5555
Similarity MeasuresSimilarity Measures
5656
Distance MeasuresDistance Measures• Measure dissimilarity between objectsMeasure dissimilarity between objects
5757
Decision TreesDecision Trees• Decision Tree (DT):Decision Tree (DT):
– Tree where the root and each internal Tree where the root and each internal node is labeled with a question. node is labeled with a question.
– The arcs represent each possible answer The arcs represent each possible answer to the associated question. to the associated question.
– Each leaf node represents a prediction of Each leaf node represents a prediction of a solution to the problem.a solution to the problem.
• Popular technique for classification; Popular technique for classification; Leaf node indicates class to which the Leaf node indicates class to which the corresponding tuple belongs.corresponding tuple belongs.
5858
Decision Tree ExampleDecision Tree Example
5959
Decision TreesDecision Trees• AA Decision Tree Model Decision Tree Model is a computational is a computational
model consisting of three parts:model consisting of three parts:– Decision TreeDecision Tree– Algorithm to create the treeAlgorithm to create the tree– Algorithm that applies the tree to data Algorithm that applies the tree to data
• Creation of the tree is the most difficult Creation of the tree is the most difficult part.part.
• Processing is basically a search similar to Processing is basically a search similar to that in a binary search tree (although DT that in a binary search tree (although DT may not be binary).may not be binary).
• Advantages:Advantages:– Easy to understand. Easy to understand. – Easy to generate rulesEasy to generate rules
• Disadvantages:Disadvantages:– May suffer from overfitting.May suffer from overfitting.– Classifies by rectangular partitioning.Classifies by rectangular partitioning.– Does not easily handle nonnumeric data.Does not easily handle nonnumeric data.– Can be quite large – pruning is Can be quite large – pruning is
necessary.necessary.
6262
Neural Networks Neural Networks • Based on observed functioning of human Based on observed functioning of human
brain. brain. • (Artificial Neural Networks (ANN)(Artificial Neural Networks (ANN)• Our view of neural networks is very Our view of neural networks is very
simplistic. simplistic. • We view a neural network (NN) from a We view a neural network (NN) from a
graphical viewpoint.graphical viewpoint.• Alternatively, a NN may be viewed from the Alternatively, a NN may be viewed from the
perspective of matrices.perspective of matrices.• Used in pattern recognition, speech Used in pattern recognition, speech
recognition, computer vision, and recognition, computer vision, and classification.classification.
6363
Neural NetworksNeural Networks• Neural Network (NN)Neural Network (NN) is a directed graph is a directed graph
F=<V,A> with vertices V={1,2,…,n} and F=<V,A> with vertices V={1,2,…,n} and arcs A={<i,j>|1<=i,j<=n}, with the arcs A={<i,j>|1<=i,j<=n}, with the following restrictions:following restrictions:– V is partitioned into a set of input nodes, VV is partitioned into a set of input nodes, V II, ,
hidden nodes, Vhidden nodes, VHH, and output nodes, V, and output nodes, VOO..– The vertices are also partitioned into layers The vertices are also partitioned into layers – Any arc <i,j> must have node i in layer h-1 Any arc <i,j> must have node i in layer h-1
and node j in layer h.and node j in layer h.– Arc <i,j> is labeled with a numeric value Arc <i,j> is labeled with a numeric value
wwijij..– Node i is labeled with a function fNode i is labeled with a function fii..
6464
Neural Network Neural Network ExampleExample
6565
NN NodeNN Node
6666
NN Activation NN Activation FunctionsFunctions• Functions associated with nodes Functions associated with nodes
in graph.in graph.• Output may be in range [-1,1] or Output may be in range [-1,1] or
[0,1][0,1]
6767
NN Activation NN Activation FunctionsFunctions
6868
NN LearningNN Learning
• Propagate input values through Propagate input values through graph.graph.
• Compare output to desired output.Compare output to desired output.• Adjust weights in graph accordingly.Adjust weights in graph accordingly.
6969
Neural NetworksNeural Networks• A A Neural Network ModelNeural Network Model is a is a
computational model consisting of three computational model consisting of three parts:parts:– Neural Network graph Neural Network graph – Learning algorithm that indicates how Learning algorithm that indicates how
learning takes place.learning takes place.– Recall techniques that determine how Recall techniques that determine how
information is obtained from the information is obtained from the network. network.
7070
NN AdvantagesNN Advantages• LearningLearning• Can continue learning even after Can continue learning even after
training set has been applied.training set has been applied.• Easy parallelizationEasy parallelization• Solves many problemsSolves many problems
7171
NN DisadvantagesNN Disadvantages
• Difficult to understandDifficult to understand• May suffer from overfittingMay suffer from overfitting• Structure of graph must be Structure of graph must be
determined a priori.determined a priori.• Input values must be numeric.Input values must be numeric.• Verification difficult.Verification difficult.
7272
Genetic AlgorithmsGenetic Algorithms• Optimization search type algorithms. Optimization search type algorithms. • Creates an initial feasible solution and Creates an initial feasible solution and
iteratively creates new “better” solutions.iteratively creates new “better” solutions.• Based on human evolution and survival of Based on human evolution and survival of
the fitness.the fitness.• Must represent a solution as an individual.Must represent a solution as an individual.• Individual:Individual: string I=I string I=I11,I,I22,…,I,…,Inn where I where Ijj is in is in
given alphabet A. given alphabet A. • Each character IEach character Ij j is called a is called a genegene.. • Population:Population: set of individuals. set of individuals.
7373
Genetic AlgorithmsGenetic Algorithms• A A Genetic Algorithm (GA)Genetic Algorithm (GA) is a is a
computational model consisting of five parts:computational model consisting of five parts:– A starting set of individuals, P.A starting set of individuals, P.– CrossoverCrossover:: technique to combine two technique to combine two
parents to create offspring.parents to create offspring.– Mutation: Mutation: randomly change an individual.randomly change an individual.– Fitness: Fitness: determine the best individuals.determine the best individuals.– Algorithm which applies the crossover and Algorithm which applies the crossover and
mutation techniques to P iteratively using mutation techniques to P iteratively using the fitness function to determine the best the fitness function to determine the best individuals in P to keep. individuals in P to keep.
7474
Crossover ExamplesCrossover Examples
111 111
000 000
Parents Children
111 000
000 111
a) Single Crossover
111 111
Parents Children
111 000
000
a) Single Crossover
111 111
000 000
Parents
a) Multiple Crossover
111 111
000
Parents Children
111 000
000 111
Children
111 000
000 11100
11
00
11
7575
Genetic AlgorithmGenetic Algorithm
7676
GA GA Advantages/DisadvantagesAdvantages/Disadvantages• AdvantagesAdvantages
– Difficult to understand and explain to Difficult to understand and explain to end users.end users.
– Abstraction of the problem and method Abstraction of the problem and method to represent individuals is quite difficult.to represent individuals is quite difficult.
– Determining fitness function is difficult.Determining fitness function is difficult.– Determining how to perform crossover Determining how to perform crossover
and mutation is difficult.and mutation is difficult.