Published on

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide


  1. 1. Data Mining Dr. Brahim Medjahed [email_address] CIS 4262 Information Systems Design and Analysis
  2. 2. Why Mining Data? (1) <ul><li>Commercial Point of View </li></ul><ul><ul><li>Lots of data is being collected </li></ul></ul><ul><ul><ul><li>Web data, e-commerce </li></ul></ul></ul><ul><ul><ul><li>Purchases at department/grocery stores </li></ul></ul></ul><ul><ul><ul><li>Bank/Credit Card Transactions </li></ul></ul></ul><ul><ul><li>High competitive pressure </li></ul></ul><ul><ul><ul><li>Provide better, customized services for an edge (e.g. in Customer Relationship Management) </li></ul></ul></ul>
  3. 3. Why Mining Data? (2) <ul><li>Scientific Point of View </li></ul><ul><ul><li>Data collected and stored at enormous speeds (TB/hour) </li></ul></ul><ul><ul><ul><li>Remote sensors on a satellite </li></ul></ul></ul><ul><ul><ul><li>Telescopes scanning the skies </li></ul></ul></ul><ul><ul><ul><li>Microarrays generating gene expression data </li></ul></ul></ul><ul><ul><ul><li>scientific simulations generating terabytes of data </li></ul></ul></ul><ul><ul><li>Data mining may help scientists in: </li></ul></ul><ul><ul><ul><li>Classifying and segmenting data </li></ul></ul></ul><ul><ul><ul><li>Hypothesis formation </li></ul></ul></ul>
  4. 4. Mining Large Data Set - Motivation <ul><li>There is often information “hidden” in the data that is not readily evident </li></ul><ul><li>Human analysts may take weeks to discover useful information </li></ul><ul><li>Much of the data is never analyzed at all </li></ul>The Data Gap Total new disk (TB) since 1995 Number of analysts From: R. Grossman, C. Kamath, V. Kumar, “Data Mining for Scientific and Engineering Applications”
  5. 5. Applications of Data Mining <ul><li>Marketing : </li></ul><ul><ul><li>Identify likely responders to sales promotions </li></ul></ul><ul><ul><li>Consumer behavior based on buying patterns </li></ul></ul><ul><ul><li>Determination of marketing strategies including advertising, store location, and targeted mailing </li></ul></ul><ul><li>Fraud detection </li></ul><ul><ul><li>Which types of transactions are likely to be fraudulent, given the demographics and transactional history of a particular customer? </li></ul></ul><ul><li>Customer relationship management </li></ul><ul><ul><li>Which of my customers are likely to be the most loyal, and which are most likely to leave for a competitor? </li></ul></ul><ul><li>Banking: loan/credit card approval </li></ul><ul><ul><li>predict good customers based on old customers </li></ul></ul><ul><li>Healthcare </li></ul><ul><ul><li>Analysis of effectiveness of certain treatments </li></ul></ul><ul><ul><li>Relating patient wellness data with doctor qualifications </li></ul></ul><ul><ul><li>Analyzing side effects of drugs </li></ul></ul><ul><li>… . </li></ul>
  6. 6. What is Data Mining? <ul><li>Process of semi-automatically analyzing large databases to find patterns that are: </li></ul><ul><ul><li>valid : hold on new data with some certainty </li></ul></ul><ul><ul><li>novel : non-obvious to the system </li></ul></ul><ul><ul><li>useful : should be possible to act on the item </li></ul></ul><ul><ul><li>understandable : humans should be able to interpret the pattern </li></ul></ul><ul><li>Another definition </li></ul><ul><ul><li>Exploration and analysis, by automatic or semi-automatic means, of large quantities of data in order to discover meaningful patterns </li></ul></ul>
  7. 7. Data Mining and Data Warehousing Data Warehousing provides the Enterprise with a memory Data Mining provides the Enterprise with intelligence
  8. 8. Data Mining as Part of the Knowledge Discovery Process (1) <ul><li>Example </li></ul><ul><ul><li>Transaction database maintained by a specialty consumer goods retailer </li></ul></ul><ul><ul><li>Client data includes </li></ul></ul><ul><ul><ul><li>Customer name, zip code, phone number, date of purchase, item code, price, quantity, total amount </li></ul></ul></ul><ul><li>Problem Formulation </li></ul><ul><ul><li>Plan additional store locations based on demographics </li></ul></ul><ul><ul><li>Run store promotions, </li></ul></ul><ul><ul><li>Combine items in advertisements </li></ul></ul><ul><ul><li>Plan seasonal marketing strategies </li></ul></ul><ul><ul><li>etc. </li></ul></ul>
  9. 9. Data Mining as Part of the Knowledge Discovery Process (2) <ul><li>Data Selection </li></ul><ul><ul><li>Data about specific items or categories of items, or from stores in a specific region or area of the country, may be selected </li></ul></ul><ul><li>Data cleansing </li></ul><ul><ul><li>Correct invalid zip codes or eliminate records with incorrect phone prefixes </li></ul></ul><ul><li>Enrichment </li></ul><ul><ul><li>Enhances the data with additional sources of information </li></ul></ul><ul><ul><li>The store may purchase data about age, income, and credit rating and append them to each record </li></ul></ul>
  10. 10. Data Mining as Part of the Knowledge Discovery Process (3) <ul><li>Data Transformation and Encoding </li></ul><ul><ul><li>Done to reduce the data </li></ul></ul><ul><ul><li>Zip codes may be aggregated into geographic regions, incomes may be divided into ten ranges, … </li></ul></ul><ul><li>Data Mining </li></ul><ul><ul><li>Mine different rules and patterns </li></ul></ul><ul><ul><ul><li>Whenever a customer buys video equipment, he/she also buys another electronic gadget </li></ul></ul></ul><ul><li>Reporting and display of the discovered information </li></ul><ul><ul><li>Results may be reported in a variety of formats, such as listings, graphic outputs, summary tables, or vizualizations </li></ul></ul>
  11. 11. Goals of Data Mining <ul><li>Prediction </li></ul><ul><li>Identification </li></ul><ul><li>Optimization </li></ul><ul><li>Classification </li></ul>
  12. 12. Goals of Data Mining (1) <ul><li>Predication </li></ul><ul><ul><li>How certain attributes within the data will behave in the future </li></ul></ul><ul><ul><ul><li>Predict what consumers will buy under certain discounts </li></ul></ul></ul><ul><ul><ul><li>Predict how much sales volume a store would generate in a given period </li></ul></ul></ul><ul><ul><ul><li>Predict whether deleting a product line would yield more profits </li></ul></ul></ul><ul><ul><ul><li>Predict an earthquake based on certain seismic wave patterns </li></ul></ul></ul>
  13. 13. Goals of Data Mining (2) <ul><li>Identification </li></ul><ul><ul><li>Use data pattern to identify the existence of an item, an event, or an activity </li></ul></ul><ul><ul><ul><li>Intruders trying to break a system may be identified by the programs executed, files accessed, and CPU time per session. </li></ul></ul></ul><ul><ul><ul><li>Existence of a gene may be identified by certain sequences of nucleotide symbols in the DNA sequence </li></ul></ul></ul><ul><li>Optimization </li></ul><ul><ul><li>Optimize the use of limited resources such as time, space, money, or materials and maximize output variables such as sales or profits under certain constraints </li></ul></ul>
  14. 14. Goals of Data Mining (3) <ul><li>Classification </li></ul><ul><ul><li>Partition data so that different classes or categories can be identified based on combinations of parameters </li></ul></ul><ul><ul><ul><li>Customers in a supermarket may be categorized into </li></ul></ul></ul><ul><ul><ul><ul><li>Discount-seeking shoppers </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Shoppers in a rush </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Loyal regular shoppers </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Infrequent shoppers </li></ul></ul></ul></ul>
  15. 15. Data Mining Tasks <ul><li>Association Rule Discovery </li></ul><ul><li>Classification </li></ul><ul><li>Clustering </li></ul><ul><li>Detection of Sequential Patterns </li></ul><ul><li>Detection of Patterns within Time Series </li></ul><ul><li>Etc. </li></ul>
  16. 16. Association Rules <ul><li>Given a set of records each of which contain some number of items from a given collection; </li></ul><ul><ul><li>Produce dependency rules which will predict occurrence of an item based on occurrences of other items. </li></ul></ul>Rules Discovered: {Milk} --> {Coke} {Diaper, Milk} --> {Beer}
  17. 17. Association Rules – Applications (1) <ul><li>Marketing and Sales Promotion: </li></ul><ul><ul><li>Let the rule discovered be </li></ul></ul><ul><ul><li>{Bagels, … } --> {Potato Chips} </li></ul></ul><ul><ul><li>Potato Chips as consequent => Can be used to determine what should be done to boost its sales. </li></ul></ul><ul><ul><li>Bagels in the antecedent => C an be used to see which products would be affected if the store discontinues selling bagels. </li></ul></ul><ul><ul><li>Bagels in antecedent and Potato chips in consequent => Can be used to see what products should be sold with Bagels to promote sale of Potato chips! </li></ul></ul>
  18. 18. Association Rules – Applications (2) <ul><li>Supermarket Shelf Management: </li></ul><ul><ul><li>Goal: To identify items that are bought together by sufficiently many customers. </li></ul></ul><ul><ul><li>Approach: Process the point-of-sale data collected with barcode scanners to find dependencies among items. </li></ul></ul><ul><li>Inventory Management: </li></ul><ul><ul><li>Goal: A consumer appliance repair company wants to anticipate the nature of repairs on its consumer products and keep the service vehicles equipped with right parts to reduce on number of visits to consumer households. </li></ul></ul><ul><ul><li>Approach: Process the data on tools and parts required in previous repairs at different consumer locations and discover the co-occurrence patterns. </li></ul></ul>
  19. 19. Prevalent Rules  Interesting Rules <ul><li>Analysts already know about prevalent rules </li></ul><ul><li>Interesting rules are those that deviate from prior expectation </li></ul><ul><li>Mining’s payoff is in finding surprising phenomena </li></ul>1995 Milk and cereal sell together! Milk and cereal sell together! 1998 Zzzz...
  20. 20. Classification <ul><li>Given old data about customers and payments, predict new applicant’s loan eligibility. </li></ul>Age Salary Profession Location Customer type Previous customers Classifier Decision rules Salary > 5 L Prof. = Exec New applicant’s data Good/ bad
  21. 21. Classification: Definition <ul><li>Predictive task: Use some variables to predict unknown or future values of other variables </li></ul><ul><li>Given a collection of records ( training set ) </li></ul><ul><ul><li>Each record contains a set of attributes , one of the attributes is the class . </li></ul></ul><ul><li>Find a model for class attribute as a function of the values of other attributes. </li></ul><ul><li>Goal: previously unseen records should be assigned a class as accurately as possible. </li></ul><ul><ul><li>A test set is used to determine the accuracy of the model. Usually, the given data set is divided into training and test sets, with training set used to build the model and test set used to validate it. </li></ul></ul>
  22. 22. Classification Example categorical categorical continuous class Training Set Learn Classifier Test Set Model
  23. 23. Classification - Application (1) <ul><li>Direct Marketing </li></ul><ul><ul><li>Goal: Reduce cost of mailing by targeting a set of consumers likely to buy a new cell-phone product. </li></ul></ul><ul><ul><li>Approach: </li></ul></ul><ul><ul><ul><li>Use the data for a similar product introduced before. </li></ul></ul></ul><ul><ul><ul><li>We know which customers decided to buy and which decided otherwise. This {buy, don’t buy} decision forms the class attribute . </li></ul></ul></ul><ul><ul><ul><li>Collect various demographic, lifestyle, and company-interaction related information about all such customers. </li></ul></ul></ul><ul><ul><ul><ul><li>Type of business, where they stay, how much they earn, etc. </li></ul></ul></ul></ul><ul><ul><ul><li>Use this information as input attributes to learn a classifier model. </li></ul></ul></ul>
  24. 24. Classification - Application (2) <ul><li>Fraud Detection </li></ul><ul><ul><li>Goal: Predict fraudulent cases in credit card transactions. </li></ul></ul><ul><ul><li>Approach: </li></ul></ul><ul><ul><ul><li>Use credit card transactions and the information on its account-holder as attributes. </li></ul></ul></ul><ul><ul><ul><ul><li>When does a customer buy, what does he buy, how often he pays on time, etc </li></ul></ul></ul></ul><ul><ul><ul><li>Label past transactions as fraud or fair transactions. This forms the class attribute. </li></ul></ul></ul><ul><ul><ul><li>Learn a model for the class of the transactions. </li></ul></ul></ul><ul><ul><ul><li>Use this model to detect fraud by observing credit card transactions on an account. </li></ul></ul></ul>
  25. 25. Classification - Application (3) <ul><li>Customer Loyalty: </li></ul><ul><ul><li>Goal: To predict whether a customer is likely to be lost to a competitor. </li></ul></ul><ul><ul><li>Approach: </li></ul></ul><ul><ul><ul><li>Use detailed record of transactions with each of the past and present customers, to find attributes. </li></ul></ul></ul><ul><ul><ul><ul><li>How often the customer calls, where he calls, what time-of-the day he calls most, his financial status, marital status, etc. </li></ul></ul></ul></ul><ul><ul><ul><li>Label the customers as loyal or disloyal. </li></ul></ul></ul><ul><ul><ul><li>Find a model for loyalty. </li></ul></ul></ul>
  26. 26. Clustering <ul><li>Descriptive task: Find human-interpretable patterns that describe the data </li></ul><ul><li>Given a set of data points, each having a set of attributes, and a similarity measure among them, find clusters such that </li></ul><ul><ul><li>Data points in one cluster are more similar to one another. </li></ul></ul><ul><ul><li>Data points in separate clusters are less similar to one another. </li></ul></ul><ul><li>Key requirement: Need a good measure of similarity between instances. </li></ul><ul><ul><li>Similarity Measures: </li></ul></ul><ul><ul><ul><li>Euclidean Distance if attributes are continuous. </li></ul></ul></ul><ul><ul><ul><li>Other Problem-specific Measures </li></ul></ul></ul>
  27. 27. Clustering - Application <ul><li>Document Clustering: </li></ul><ul><ul><li>Goal: To find groups of documents that are similar to each other based on the important terms appearing in them. </li></ul></ul><ul><ul><li>Approach: To identify frequently occurring terms in each document. Form a similarity measure based on the frequencies of different terms. Use it to cluster. </li></ul></ul><ul><ul><li>Gain: Information Retrieval can utilize the clusters to relate a new document or search term to clustered documents. </li></ul></ul>
  28. 28. Detection of Sequential Patterns <ul><li>A sequence of actions or events is sought </li></ul><ul><li>Given is a set of objects , with each object associated with its own timeline of events , find rules that predict strong sequential dependencies among different events. </li></ul>(A B) (C) (D E)
  29. 29. Sequential Patterns - Examples <ul><li>In healthcare </li></ul><ul><ul><li>If a patient underwent cardiac bypass surgery for blocked arteries and an aneurysm and later developed high blood urea within a year of surgery, he or she is likely to suffer from kidney failure within the next 18 months </li></ul></ul><ul><li>In point-of-sale transaction sequences , </li></ul><ul><ul><li>Computer Bookstore: </li></ul></ul><ul><ul><li> (Intro_To_Visual_C) (C++_Primer) --> (Perl_for_dummies,Tcl_Tk) </li></ul></ul><ul><ul><li>Athletic Apparel Store: </li></ul></ul><ul><ul><li> (Shoes) (Racket, Racketball) --> (Sports_Jacket) </li></ul></ul>
  30. 30. Detection of Patterns within Time Series <ul><li>Similarities can be detected within positions of the time series </li></ul><ul><li>Examples </li></ul><ul><ul><li>Stocks of a utility company ABC Power and a financial company XYZ Securities show the same pattern during 1998 in terms of closing stock price </li></ul></ul><ul><ul><li>Two products show the same selling pattern in summer but a different one in winter </li></ul></ul>
  31. 31. More about Associations Rules <ul><li>Retail Shops </li></ul><ul><ul><li>Someone who buys bread is quite likely to buy milk </li></ul></ul><ul><ul><li>A person who bought the book “Database System Concepts” is quite likely to buy the book “Operating Systems Concepts” </li></ul></ul><ul><li>Data consists of 2 parts: </li></ul><ul><ul><li>Transactions: customers purchases </li></ul></ul><ul><ul><li>Items: things that we bought </li></ul></ul><ul><li>For each transaction, there is a list of items </li></ul>
  32. 32. Example Bread, cookies, coffee 8:40 1735 Milk, eggs 8:05 1130 Milk, juice 7:38 792 Milk, bread, juice 6:35 101 Items Bought Time Transaction ID Customer buys juice Customer buys both Customer buys milk
  33. 33. Association Rule Form <ul><li>X  Y </li></ul><ul><ul><li>Where X={x 1 ,…,x n } and Y={y 1 ,…,y m } are sets of items </li></ul></ul><ul><ul><li>If a customer buys X, he/she is likely to buy Y </li></ul></ul><ul><li>We need to automatically discover such association rules </li></ul><ul><li>Two concepts to measure the strength of an association </li></ul><ul><ul><li>Support </li></ul></ul><ul><ul><li>Confidence </li></ul></ul>
  34. 34. Support <ul><li>Support of X  Y </li></ul><ul><ul><li>Also called prevalence </li></ul></ul><ul><ul><li>Percentage of transactions that hold all the items of the union X  Y </li></ul></ul><ul><ul><li>Probability that the 2 item sets occurred together </li></ul></ul><ul><ul><li>Estimated by: </li></ul></ul><ul><ul><ul><li>Transactions that contain every item in X and Y </li></ul></ul></ul><ul><ul><ul><li>All transactions </li></ul></ul></ul>
  35. 35. Example - Support of Milk  Juice ? - Support of Bread  Juice ? Bread, cookies, coffee 8:40 1735 Milk, eggs 8:05 1130 Milk, juice 7:38 792 Milk, bread, juice 6:35 101 Items Bought Time Transaction ID
  36. 36. Large and Small Itemsets <ul><li>Support threshold: user-specified </li></ul><ul><li>Large Itemsets </li></ul><ul><ul><li>Sets of items that have a support that exceeds a certain threshold </li></ul></ul><ul><li>Small Itemsets </li></ul><ul><ul><li>Sets of items that have a support that is below a certain threshold </li></ul></ul>
  37. 37. Confidence <ul><li>Confidence of the rule X  Y </li></ul><ul><ul><li>Conditional probability of a transaction containing item set Y given that it contains items set X </li></ul></ul><ul><li>Estimated by: </li></ul><ul><ul><li>Transactions that contain every item in X and Y </li></ul></ul><ul><ul><li>Transactions that contain the items in X </li></ul></ul><ul><li>Confidence threshold: user-specified </li></ul>
  38. 38. Example - Confidence of Milk  Juice ? - Confidence of Bread  Juice ? Bread, cookies, coffee 8:40 1735 Milk, eggs 8:05 1130 Milk, juice 7:38 792 Milk, bread, juice 6:35 101 Items Bought Time Transaction ID
  39. 39. Goal of Mining Association Rules <ul><li>Generate all possible rules that exceed some minimum user-specified support and confidence thresholds </li></ul>
  40. 40. Generating Large Itemsets – Exploratory Method <ul><li>Consider all possibilities </li></ul><ul><li>Example: three items a, b, and c </li></ul><ul><ul><li>{a}, {b}, {c}, {a,b}, {b,c}, {a,c}, {a,b,c} </li></ul></ul><ul><li>Works for a very small number of items </li></ul><ul><li>Very computation intensive if the number of items becomes large (thousands) </li></ul><ul><ul><li>If the number of items is m , then the number of distinct items sets is 2 m </li></ul></ul>
  41. 41. Generating Large Itemsets – A Priori Method <ul><li>Idea </li></ul><ul><ul><li>A subset of a large itemset must also be large </li></ul></ul><ul><ul><ul><li>if {juice, milk, bread} is frequent, so is {juice, bread} </li></ul></ul></ul><ul><ul><ul><li>Every transaction having {juice, milk, bread} also contains {juice, bread} </li></ul></ul></ul><ul><ul><li>Conversely, an extension of a small itemset is also small </li></ul></ul><ul><ul><ul><li>If there is any itemset which is infrequent, its superset should not be generated/tested! </li></ul></ul></ul><ul><li>Overview : </li></ul><ul><ul><li>Only sets with single items are considered in the first pass. </li></ul></ul><ul><ul><li>In the second pass, sets with two items are considered, and so on. </li></ul></ul>
  42. 42. Generating Large Itemsets – A Priori Method (cont’d) <ul><li>Test the support for itemsets of length 1, called 1-itemsets by scanning the database </li></ul><ul><ul><li>Discard those that do not exceed the threshold </li></ul></ul><ul><li>Extend the large 1-itemsets into 2-itemsets by appending one item each time, to generate all candidate itemsets of length two </li></ul><ul><ul><li>Test the support for all candidate itemsets by scanning the database and eliminate those 2-itemsets that do not meet the minimum support </li></ul></ul><ul><li>Repeat the above steps. </li></ul><ul><ul><li>At step k, the previously found (k-1) itemsets are extended into k-itemsets and tested for minimum support </li></ul></ul><ul><li>The process is repeated until no large itemsets can be found </li></ul>
  43. 43. The A Priori Method - Example Frequency ≥ 50%, Confidence 100%: A  C B  E BC  E CE  B BE  C Database TDB 1 st scan C 1 L 1 L 2 C 2 C 2 2 nd scan C 3 L 3 3 rd scan B, E 40 A, B, C, E 30 B, C, E 20 A, C, D 10 Items Tid 1 {D} 3 {E} 3 {C} 3 {B} 2 {A} sup Itemset 3 {E} 3 {C} 3 {B} 2 {A} sup Itemset {C, E} {B, E} {B, C} {A, E} {A, C} {A, B} Itemset 1 {A, B} 2 {A, C} 1 {A, E} 2 {B, C} 3 {B, E} 2 {C, E} sup Itemset 2 {A, C} 2 {B, C} 3 {B, E} 2 {C, E} sup Itemset {B, C, E} Itemset 2 {B, C, E} sup Itemset