Data Mining Office Add-ins were introduced with SQL Server 2005, and a new version is available for SQL Server 2008 to take advantage of the improvements made to Analysis Services data mining. In this module, we’ll review how to use the Data Mining Add-ins, and then examine the changes made to mining structures as well as the new Time Series alogrithm.
Data Mining Add-ins for Office allow you to perform a variety of data mining tasks. You can prepare data by applying data cleansing, and you can partition the data into training and test sets. Some of the add-in tools are focused on exploring your data, while other tools are built specifically for prediction purposes. The add-ins also includes functionality for testing and validating each model.Point out that the add-ins are also useful as a client viewer for data mining models developed on the server.
This slide shows the data preparation tasks : Explore Data (to find anomalies), clean data (to handle outliers or erroenous data, and partition data to separate it into training and test data.In the background is a view used to consolidate information from several tables. Transformations have been applied to enforce business rules. This logical table is then used as the source for data mining activities –whether using the add-ins or using BI Development Studio.
This slide identifies the table analysis tools that are exploration-based data mining tools and identifies the data mining algorithm associated with the tool.
This slide identifies the data modeling tools that are exploration-based data mining tools and identifies the data mining algorithm associated with the tool.
Model viewers are available not only for mining data models created by using the add-in, but also for mining models created on the server.
This slide shows the predictive tools and shows the related algorithm.
Prediction tools are also available in the Data Modeling ribbon of Excel. Here you see the algorithm associated with these predictive tools.
The Data Mining add-in also includes model testing and validation tools, such as an Accuracy cart, a classification matrix, and a profit chart. Cross Validation is also new to Analysis Services data mining and will be discussed in more detail later in this module.
In this section, we’ll review the improvements for mining structures in SSAS 2008. Specifically, we’ll look at setting up data partitions for training and testing dta, how to us aliases with mining model columns, how to apply filers to data associated with a mining model, how to drillthrough to details when studying data mining results, and how to use the cross-validation report to assess the accuracy of a model or to compare multiple models to find the best model.
To create training and testing sets using random data for SSAS 2005, best practice was to use the Random Sample transformation in SSIS 2005. However, the package design was particularly cumbersome for structures with nested tables. In SSAS 2008, the process to generate random data sets for training and testing is built in.You can specify parameters for partitioning data into training and testing sets: In the Data Mining Wizard In the Properties pane of the mining structureAnalysis services uses a random sampling algorithm to assign data to either the training or the testing data set.If you provide both a percentage and maximum number of rows, the smaller number prevails. For example, you can specify a percentage of 30% of the entire data set which is not to exceed 1,000 rows if the data source continues to grow. When using the same data source view for multiple mining structures, you might want to keep the same partitioning strategy for each mining structure. Set the HoldoutSeed property to the same value in each structure to yield comparable results in the training and testing data sets.You can also define partitioning using DMX, AMO, or XML DDL.Point out that partitioning is not available for a model using the Time Series algorithm.
For those who prefer to use DMX to create mining structures instead of the user interface, DMX now supports partitioning when the mining structure is created. Point out that HOLDOUT cannot be used with ALTER MINING STRUCTURE.The process to train the model – using INSERT INTO MINING STRUCTURE – is unchanged. The query executes and data is random sampled. A holdout store is created for each partition of the mining structure. In SSAS 2008, you can now query the structure to view the contents of the training and testing data sets.
In SSAS 2005, you could change the name of a mining model column in Business Intelligence Development Studio, but not in DMX. One reason you might want to use alias a column is when you want to use the same column with different algorithms, but one algorithm supports continuous columns and the other does not. You can add a column to the mining structure more than once and set the Content property to a different value for each version of the column. Ignore the column in the model where the content type is unsupported, and include it as an input column in models supporting that content type. By enabling the use of an alias, you can use the same NATURAL PREDICTION JOIN for the models in the same mining structure because input columns are bound by name to the model column.
Instead of creating separate data source views for your mining structure, you can create separate filtered models. Each model contains the same training and testing data which allows you to compare model results. Why create filtered models?Achieve better overall accuracy by eliminating strong patterns of one attribute value (e.g. North America versus Pacific).Compare patterns in isolated subsets of data.You can create filers: In the Model Filter dialog box In the Properties pane of the mining modelIn the case of discretized values, the bucket containing the specified value is selected. Example: Age = 23 returns bucket containing 20-25 ages.An example of a filter expression for a case table and a nested table:Gender = ‘M’ and EXISTS(select * from Products where Model = ‘Water Bottle’)Point out that NOT EXISTS is also valid.Mention the URL on the Resources slide for more information about filter syntax.You must process the mining structure to see the filter applied to the model.
Mention that using drillthrough in a filtered model returns all cases matching the filter, whether used for training or testing.
As in SSAS 2005, the following algorithms do not support drill through: NaïveBayes Neural Network Logistic RegressionThe Time Series algorithm supports drill through in a DMX query only; drill through is not supported in Business Intelligence Development Studio.
Using parameters you specify, cross-validation automatically creates partitions of the data set of approximately equal size. For each partition, a mining model is created for the entire data set with one of the partitions removed, and then tested for accuracy using the partition that was excluded. If the variations are subtle, then the model generalizes well. If there is too much variation, then the model is not useful.Point out that cross-validation cannot be used with models built using the Time Series or Sequence Clustering algorithms.You can use the Cross Validation Report in the Mining Accuracy Chart of Business Intelligence Development Studio, or use Analysis Services stored procedures to create an ad hoc cross-validation SQL Server Management Studio.
More folds results in longer processing time.
This slide and the next outlines the types of tests and their respective measures that are found on the cross-validation report. Different models will use different test types for this report. Point out the report can be generated in Business Intelligence Development Studio, which will be shown in the demonstration, or by calling an Analysis Services stored procedure.
Data mining in SSAS 2008 was also improved by modifying the Time Series algorithm. In this section, we’ll review why the mining structure is improved and we’ll review the algorithm parameters for the Time Series algorithm.
In SSAS 2005, the ARTxp Time Series prediction algorithm (autoregressive tree model for multiple prior unknown states), built by Microsoft Research, was introduced. The purpose of this algorithm was to tackle a difficult business problem – how to accuractly predict the next step in a series. It was less reliable for predicting 10 steps or further out.ARIMA (autoregressive integrated moving average) is a very common time series algorithm that is well understood by seasoned data miners. It provides good predictions when projecting beyond the next 10 steps. In SSAS 2008, the Microsoft Time Series algorithm blends results of the two algorithms to leverage short and long term capabilities.In Standard Edition, you can configure your model to use one or the other algorithm, or both (which is the default). In Enterprise Edition, you can do custom weighting to get best prediction over a variable time span.
The FORECAST_METHOD default value is MIXED. You can change this to use ARIMA or ARTXP to use a single algorithm exclusively.The PREDICTION_SMOOTHING parameter affects the weighting of the ARTxpand ARIMAalgorithms when MIXED mode is used. A value closer to 0 weights in favor of ARTxp while a value closer to 1 weights in favor of ARIMA. For example, a value of 0.8 is weighted towards ARIMA and the value of 0.2 is used for ARTxp.
Transcript of "Minería de Datos en Sql Server 2008"
Data Mining in SQL Server 2008<br />Ing Eduardo Castro<br />GrupoAsesor en Informática<br />firstname.lastname@example.org<br />
Eduardo Castro<br />email@example.com<br />MCITP Server Administrator<br />MCTS Windows Server 2008 ActiveDirectory<br />MCTS Windows Server 2008 Network Infrastructure<br />MCTS Windows Server 2008 Applications Infrastructure<br />MCITP Enterprise Support<br />MCSTS Windows Vista<br />MCITP Database Developer<br />MCITP Database Administrator<br />MCTS SQL Server<br />MCITP Exchange Server 2007<br />MCTS Office PerformancePoint Server<br />MCTS Team Foundation Server<br />MCPD Enterprise Application Developer<br />MCTS .Net Framework 2.0: Distributed Applications<br />MCT 2008<br />International Association of Software Architects Chapter Leader<br />IEEE Communications Society Board of Directors<br />European Datawarehouse Research<br />
Time series</li></ul>Cluster Profiles<br /><ul><li>Distribution of values for each attribute
Drill through to details</li></ul>Cluster Characteristics<br /><ul><li>Attributes ordered by importance to cluster
Probability attribute appearing in cluster</li></ul>Cluster Discrimination<br /><ul><li>Comparison of attributes between two clusters</li></li></ul><li>Tools for Prediction - Table Analysis Tools <br />
Tools for Prediction - Data Modeling Tools<br />
Model Testing and Validation<br />Accuracy Chart<br /><ul><li>Measurement of model accuracy
Lift chart comparing actual results to random guess and to perfect prediction</li></ul>Classification Matrix<br /><ul><li>Shows correct and incorrect predictions
Displays percentage and counts</li></ul>Profit Chart<br /><ul><li>Estimation of profit by percentage of population contacted
Input: population, fixed cost, individual cost, revenue per individual
Output: maximum profit, probability threshold</li></ul>Cross Validation – more on this later<br />
1 Using the Data Mining Excel Add-In<br />demo <br />
Understanding Data Mining Structure Improvements<br />Data Partitioning for Training and Testing<br />Mining Model Column Aliases<br />Data Mining Filters<br />Drill Through to Mining Structure Data<br />Cross-Validation of a Mining Model<br />
Data Partitioning for Training and Testing<br />Specify as percentage or maximum number of cases<br />Smaller value is used if both parameters specified<br />Data is divided randomly between training and testing<br />HoldoutSeed property enables consistent partitions across structures<br />
Data Partitioning with DMX<br />Create a structure with partitioning with the HOLDOUT keyword<br />Query the structure to review partitions<br />
Mining Model Column Aliases<br />Assign a column alias to reuse a column in a structure<br />Column content can be clarified<br />Column can be more easily referenced in DMX<br />Continuous and discretized versions of the same column can be used in separate models in the same structure<br />
Data Mining Filters<br />Specify a condition to apply to mining structure columns <br />Filter creates subsets of training and testing data for a model<br />Multiple conditions can be linked with AND/OR operators<br />Conditions for continuous value use > , >=, <, <= operators<br />Conditions for discrete values use =, !=, or is null operators<br />Conditions on nested tables can use EXISTS keyword and subquery<br />
Data Mining Filters with DMX<br />Add a filtered mining model to a structure<br />
Drill Through to Mining Structure Data<br />Add columns to the mining structure, but not to models<br />Eliminates unnecessary data from model and improves processing time<br />Supports drill through from mining model viewer or DMX for visibility into results<br />
Cross-Validation of a Mining Model<br />Purpose<br />Validate the accuracy of a single model<br />Compare models within the same mining structure<br />Process<br />Split mining structure into partitions of equal size<br />Iteratively build models on all partitions excluding one partition such that all partitions are excluded once<br />Measure accuracy of each model using the excluded partition<br />Analyze results<br />
Cross-Validation Parameters<br />Fold Count<br />Number of partitions to use<br />Minimum 2, Maximum 256<br />Maximum 10 for session mining structure<br />Max Cases<br />Total number of cases to include in cross-validation<br />Cases divided across folds<br />Value of 0 specifies all cases<br />Target Attribute<br />Predictable column <br />Target State<br />Target value for target attribute<br />Value of null specifies all states are to be tested<br />Target Threshold<br />Value between 0 and 1 for prediction probability above which a predicted state is considered correct<br />Value of null specifies most probable prediction is considered correct<br />
2 Creating a Clustering Model<br />demo <br />
Using the New Time Series Algorithm<br />Better Time Series Support<br />Time Series Algorithm Parameters<br />
Better Time Series Support<br />ARTxp algorithm<br />Still included in Microsoft Time Series algorithm<br />Best for prediction of next likely value in a series<br />ARIMA algorithm<br />Added to Microsoft Time Series algorithm<br />Best for long-term predictions<br />The new Microsoft Time Series algorithm<br />Trains one model using ARTxp and second model using ARIMA<br />Blends the results to return best prediction <br />