Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 2 Overview of the Data Mining Process 1. Introduction Data Mining – Predictive analysis Tasks of Classification & Prediction Core of Business.

Similar presentations


Presentation on theme: "Chapter 2 Overview of the Data Mining Process 1. Introduction Data Mining – Predictive analysis Tasks of Classification & Prediction Core of Business."— Presentation transcript:

1 Chapter 2 Overview of the Data Mining Process 1

2 Introduction Data Mining – Predictive analysis Tasks of Classification & Prediction Core of Business Intelligence Data Base Methods – OLAP – SQL – Do not involve statistical modeling 2

3 Core Ideas in Data Mining Analytical Methods Used in Predictive Analytics – Classification Used with categorical response variables E.g. Will purchase be made / not made? – Prediction Predict (estimate) value of continuous response variable Prediction used with categorical as well – Association Rules Affinity analysis – “what goes with what” Seeks correlations among data 3

4 Core Ideas in Data Mining Data Reduction – Reduce variables – Group together similar variables Data Exploration – View data as evidence – Get “a feel” for the data Data Visualization – Graphical representation of data – Locate tends, correlations, etc. 4

5 Supervised Learning “Supervised learning" algorithms are those used in classification and prediction. – Data is available in which the value of the outcome of interest is known. “Training data" are the data from which the classification or prediction algorithm “learns," or is “trained," about the relationship between predictor variables and the outcome variable. This process results in a “model” – Classification Model – Predictive Model 5

6 Model is then run with another sample of data – “validation data" – the outcome is known but we wish to see how well the model performs – If many different models are being tried out, a third sample of known outcomes -“test data” is used with the final, selected model to predict how well it will do. The model can then be used to classify or predict the outcome of interest in new cases where the outcome is unknown. 6 Supervised Learning

7 Linear regression analysis is an example of supervised Learning – The Y variable is the (known) outcome variable – The X variable is some predictor variable. – A regression line is drawn to minimize the sum of squared deviations between the actual Y values and the values predicted by this line. – The regression line can now be used to predict Y values for new values of X for which we do not know the Y value. 7

8 Unsupervised Learning No outcome variable to predict or classify No “learning” from cases Unsupervised leaning methods – Association Rules – Data Reduction Methods – Clustering Techniques 8

9 The Steps in Data Mining 1. Develop an understanding of the purpose of the data mining project – It is a one-shot effort to answer a question or questions or – Application (if it is an ongoing procedure). 2. Obtain the dataset to be used in the analysis. – Random sampling from a large database to capture records to be used in an analysis – Pulling together data from different databases. Internal (e.g. Past purchases made by customers) External (credit ratings). – Usually the analysis to be done requires only thousands or tens of thousands of records. 9

10 The Steps in Data Mining 3. Explore, clean, and preprocess the data – Verifying that the data are in reasonable condition. – How missing data should be handled? – Are the values in a reasonable range, given what you would expect for each variable? – Are there obvious “outliers?" – Data are reviewed graphically – For example, a matrix of scatter plots showing the relationship of each variable with each other variable. – Ensure consistency in the definitions of fields, units of measurement, time periods, etc. 10

11 The Steps in Data Mining 4. Reduce the data – If supervised training is involved separate them into training, validation and test datasets. – Eliminating unneeded variables, Transforming variables – Turning “money spent" into “spent > $100" vs. “Spent · $100"), Creating new variables – A variable that records whether at least one of several products was purchased – Make sure you know what each variable means, and whether it is sensible to include it in the model. 5. Determine the data mining task – Classification, prediction, clustering, etc. 6. Choose the data mining techniques to be used – Regression, neural nets, hierarchical clustering, etc. 11

12 The Steps in Data Mining 7. Use algorithms to perform the task. – Iterative process - trying multiple variants, and often using multiple variants of the same algorithm (choosing different variables or settings within the algorithm). – When appropriate, feedback from the algorithm's performance on validation data is used to refine the settings. 8. Interpret the results of the algorithms. – Choose the best algorithm to deploy, – Use final choice on the test data to get an idea how well it will perform. 9. Deploy the model. – Integrate the model into operational systems – Run it on real records to produce decisions or actions. – For example, the model might be applied to a purchased list of possible customers, and the action might be “include in the mailing if the predicted amount of purchase is > $10." 12

13 Preliminary Steps Organization of datasets – Records in rows – Variables in columns In supervised learning one of these will be the outcome variable Labels the first or last column Sampling from a database – Use a samples to create, validate, & test model Oversampling rare events – If response variable value is seldom found in data then sample size increase – Adjust algorithm as necessary 13

14 Preliminary Steps (Pre-processing and Cleaning the Data) Types of variables – Continuous – assumes a any real numerical value (generally within a specified range) – Categorical – assumes one of a limited number of values Text (e.g. Payments e {current, not current, bankrupt} Numerical (e.g. Age e {0 … 120} ) Nominal (payments) Ordinal (age) 14

15 Preliminary Steps (Pre-processing and Cleaning the Data) Handling categorical variables – If categorical is ordered then it can be used as continuous variable (e.g. Age, level of credit, etc.) – Use of “dummy” variables when range of values not large e.g. Variable occupation e {student, unemployed, employed, retired} Create binary (yes/no) dummy variables – Student – yes/no – Unemployed – yes/no – Employed – yes/no – Retired – yes/no Variable selection – The more predictor variables the more records need to build the model – Reduce number of variables whenever appropriate 15

16 Preliminary Steps (Pre-processing and Cleaning the Data) Overfitting – Building a model - describe relationships among variables in order to predict future outcome (dependent) values on the basis of future predictor (independent) values. – Avoid “explaining“ variation in the data that was nothing more than chance variation. Avoid mislabeling “noise” in the data as if it were a “signal” – Caution - if the dataset is not much larger than the number of predictor variables, then it is very likely that a spurious relationship like this will creep into the model 16

17 Overfitting 17

18 Preliminary Steps (Pre-processing and Cleaning the Data) How many variables & how much data A good rule of thumb is to have ten records for every predictor variable. For classification procedures – At least 6xmxp records, – Where m = number of outcome classes, and p = number of variables Compactness or parsimony is a desirable feature in a model. A matrix of x-y plots can be useful in variable selection. Can see at a glance x-y plots for all variable combinations. – A straight line would be an indication that one variable is exactly correlated with another. – We would want to include only one of them in our model. Weed out irrelevant and redundant variables from our model Consult domain expert whenever possible 18

19 Preliminary Steps (Pre-processing and Cleaning the Data) Outliers – Values that lie far away from the bulk of the data are called outliers – no statistical rule can tell us whether such an outlier is the result of an error – these are judgments best made by someone with “domain" knowledge – if the number of records with outliers is very small, they might be treated as missing data. 19

20 Preliminary Steps (Pre-processing and Cleaning the Data) Missing values – If the number of records with missing values is small, those records might be omitted – The more variables, the more records to dropped Solution - use average value computed from records with valid data for variable with missing data Reduces variability in data set – Human judgment can be used to determine best way to handle missing data 20

21 Preliminary Steps (Pre-processing and Cleaning the Data) Normalizing (standardizing) the data – To normalize the data, we subtract the mean from each value, and divide by the standard deviation of the resulting deviations from the mean Expressing each value as “number of standard deviations away from the mean“ – the z-score Needed if variables are in different units e.G. Hours, thousands of dollars, etc. – Clustering algorithms measure variables values in distance from each other – need a standard value for distance. – Data mining software, including XLMiner, typically has an option that normalizes the data in those algorithms where it may be required 21

22 Preliminary Steps Use and creation of partition – Training partition The largest partition Contains the data used to build the various models Same training partition is generally used to develop multiple models. – Validation partition Used to assess the performance of each model, Used to compare models and pick the best one. In classification and regression trees algorithms the validation partition may be used automatically to tune and improve the model. – Test partition Sometimes called the “holdout" or “evaluation" partition is used to assess the performance of a chosen model with new data. 22

23 The Three Data Partitions and Their Role in the Data Mining Process 23

24 Example – Linear Regression Boston Housing Data 24

25 25

26 Partitioning the data 26

27 Using XLMiner for Multiple Linear Regression 27

28 Specifying Output 28

29 Prediction of Training Data 29

30 Prediction of Validation Data 30

31 Summary of errors 31

32 RMS error Error = actual - predicted RMS = Root-mean-squared error = Square root of average squared error In previous example, sizes of training and validation sets differ, so only RMS Error and Average Error are comparable 32

33 Using Excel and XLMiner for Data Mining Excel is limited in data capacity However, the training and validation of DM models can be handled within the modest limits of Excel and XLMiner Models can then be used to score larger databases XLMiner has functions for interacting with various databases (taking samples from a database, and scoring a database from a developed model) 33

34 Simple Regression Example 34

35 Simple Regression Model Make prediction about the starting salary of a current college graduate Data set of starting salaries of recent college graduates 35 Data SetCompute Average Salary How certain are of this prediction? There is variability in the data.

36 Compute Total Variation Simple Regression Model The smaller the amount of total variation the more accurate (certain) will be our prediction. Use total variation as an index of uncertainty about our prediction 36

37 Simple Regression Model How “explain” the variability - Perhaps it depends on the student’s GPA 37 Salary GPA

38 Find a linear relationship between GPA and starting salary As GPA increases/decreases starting salary increases/decreases 38 Simple Regression Model

39 Least Squares Method to find regression model – Choose a and b in regression model (equation) so that it minimizes the sum of the squared deviations – actual Y value minus predicted Y value (Y-hat) 39 Simple Regression Model

40 How good is the model? 40 Simple Regression Model  u-hat is a “residual” value  The sum of all u-hats is zero  The sum of all u-hats squared is the total variance not explained by the model  “unexplained variance” is 7,425,926 a= 4,779 & b = 5,370 A computer program computed these values

41 Simple Regression Model 41 Total Variation = 23,000,000

42 42 Simple Regression Model Total Unexplained Variation = 7,425,726

43 Simple Regression Model Relative Goodness of Fit – Summarize the improvement in prediction using regression model Compute R 2 – coefficient of determination 43 Regression Model (equation) a better predictor than guessing the average salary The GPA is a more accurate predictor of starting salary than guessing the average R 2 is the “performance measure“ for the model. Predicted Starting Salary = 4,779 + 5,370 * GPA

44 Detailed Regression Example 44

45 Data Set 45 Obs #SalaryGPAMonths Work 1200002.848 2245003.424 3230003.224 4250003.824 5200003.248 6225003.436 7275004.020 8190002.648 9240003.236 10285003.812

46 Scatter Plot - GPA vs Salary 46

47 Scatter Plot - Work vs Salary 47

48 Pearson Correlation Coefficients -1 <= r <= 1 48 SalaryGPA Months Work Salary1 GPA0.8980071 Months Work-0.93927-0.829931

49 Three Regressions Salary = f(GPA) Salary = f(Work) Salary = f(GPA, Work) Interpret Excel Output 49

50 Interpreting Results Regression Statistics – Multiple R, – R 2, – R 2 adj – Standard Error S y Statistical Significance – t-test – p-value – F test 50

51 Regression Statistics Table 51 Multiple R – R = square root of R 2 R 2 – Coefficient of Determination R 2 adj – used if more than one x variable Standard Error S y – This is the sample estimate of the standard deviation of the error (actual – predicted)

52 ANOVA Table 52 Table 1 gives the F statistic Tests the claim – there is no significant relationship between your all of your independent and dependent variables The significance F value is a p-value should reject the claim: – Of NO significant relationship between your independent and dependent variables if p<  – Generally  = 0.05

53 Regression Coefficients Table 53 Coefficients Column gives – b 0, b 1,, b 2, …, b n values for the regression equation. – The b 0 is the intercept – b 1 value is next to your independent variable x 1 – b 2 is next to your independent variable x 2. – b 3 is next to your independent variable x 3

54 Regression Coefficients Table p values for individual t tests each independent variables t test - tests the claim that there is no relationship between the independent variable (in the corresponding row) and your dependent variable. Should reject the claim Of NO significant relationship between your independent variable (in the corresponding row) and dependent variable if p< . 54

55 Salary = f(GPA) 55 Regression Statisticsf(GPA) Multiple R 0.898006642 R Square 0.806415929 Adjusted R Square 0.78221792 Standard Error 1479.019946 Observations 10 ANOVA dfSSMSFSignificance F Regression172900000 33.325710.00041792 Residual8175000002187500 Total990400000 Coefficients Standard Errort StatP-valueLower 95%Upper 95% Intercept1928.5714293748.6770.5144670.620833-6715.8932610573.04 GPA6428.5714291113.5895.7728430.0004183860.631738996.511

56 Salary = f(Work) 56 Regression Statisticsf(Work) Multiple R0.939265177 R Square0.882219073 Adjusted R Square0.867496457 Standard Error1153.657002 Observations10 ANOVA dfSSMSFSignificance F Regression179752604.177975260459.922715.52993E-05 Residual810647395.831330924 Total990400000 Coefficients Standard Errort StatP-valueLower 95%Upper 95% Intercept30691.666671010.13634430.383691.49E-0928362.2880833021.0453 Months Work-227.86458329.43615619-7.740985.53E-05 - 295.7444812-159.98469

57 Salary = f(GPA, Work) 57 Regression Statistics f(GPA,Work) Multiple R0.962978985 R Square0.927328525 Adjusted R Square0.906565246 Standard Error968.7621974 Observations10 ANOVA dfSSMSFSignificance F Regression2838304994191524944.661950.00010346 Residual76569501938500.2 Total990400000 Coefficients Standard Errort StatP-valueLower 95%Upper 95% Intercept19135.928965608.1843.4121440.0112555874.68211232397.176 GPA2725.4098361307.4682.0844950.075582-366.26029835817.08 Months Work-151.212431744.30826-3.412740.011246-255.9848174 - 46.440046

58 Compare Three “Models” 58 Regression Statistics f(GPA,Work) Multiple R0.962978985 R Square0.927328525 Adjusted R Square0.906565246 Standard Error968.7621974 Observations10 Regression Statisticsf(Work) Multiple R0.939265177 R Square0.882219073 Adjusted R Square0.867496457 Standard Error1153.657002 Observations10 Regression Statisticsf(GPA) Multiple R0.898006642 R Square0.806415929 Adjusted R Square0.78221792 Standard Error1479.019946 Observations10


Download ppt "Chapter 2 Overview of the Data Mining Process 1. Introduction Data Mining – Predictive analysis Tasks of Classification & Prediction Core of Business."

Similar presentations


Ads by Google