434
SQL Server 2012 Upgrade Technical Guide
80 percent of the population for 80 percent of bike buyers, 60 percent of the
population for 60 percent of bike buyers, and so on.
Data mining models give better results in terms of percentage of bike buyers than the
Random Guess line but worse results than the Ideal Model line. From the Lift Chart, you
can measure the lift of the mining models from the Random Guess line, which is where
the name Lift Chart comes from. Of course, a model predicts the outcome with less
than 100 percent probability in all ranges of the population; therefore, to get 100
percent of bike buyers, you still need 100 percent of the population. Data mining
models give you interesting results somewhere between zero and 100 percent of the
population. For example, if you take the highest curve, the one right below the Ideal
Model line, you can see that if you select 70 percent of the population based on this
model, you would get nearly 90 percent of bike buyers. From the Mining Legend
window, you can see that this is the Decision Trees curve. In terms of accuracy of
predictions from the demo data used for analysis, the Decision Trees algorithm
generates the best predictions, the Neural Network algorithm generates the second
best, the Naïve Bayes algorithm generates the third best, and the Clustering algorithm
generates the fourth best. In this example, if you checked the Lift Chart in SSAS 2005,
you probably decided to deploy the Decision Trees model into production.
Cross-Validation
A Lift Chart is useful, but it does not tell you how reliable your predictive models are.
You do not know whether they behave the same using different data—that is, how
robust the predictions are with different data sets. In SSAS 2012, you can test the
reliability of predictive models by using cross-validation. With cross-validation, you
partition your training data set into many smaller sections. SSAS creates multiple
models on the cross-sections, using one section at a time as test data and other
sections as training data, and then trains the models and creates many different
accuracy measures across partitions. If the measures across various partitions differ a
lot, the model is not robust on different training/test set combinations.
Figure 10 shows the cross-validation settings you can specify as well as the cross-
validation results of predictive models.
435
SQL Server 2012 Upgrade Technical Guide
Figure 10: Cross-validation of predictive models—Decision Trees
You can define the following cross-validation settings:
Fold Count. With this setting, you define how many partitions you want to
create in your training data. In Figure 10, three partitions are created. When
partition 1 is used as the test data, the model is trained on partitions 2 and 3.
When partition 2 is used as the test data, the model is trained on partitions 1
and 3. When partition 3 is used as the test data, the model is trained on
partitions 1 and 2.
Max Cases. You can define the maximum number of cases to use for cross-
validation. Cases are taken randomly from each partition. Our example uses
9,000 cases, which means that each partition will hold 3,000 cases.
Target Attribute. This is the variable you are predicting.
Target State. You can check overall predictions by leaving this field empty, or
you can check predictions for a single state that you are interested in. In our
example, we are interested in bike buyers (state 1).
436
SQL Server 2012 Upgrade Technical Guide
Target Threshold. You use this parameter to set the accuracy bar for the
predictions. If the predict probability exceeds your accuracy bar, the prediction is
considered correct; if not, the prediction is considered incorrect.
The cross-validation report below the settings shows many different measures to help
you check the reliability of your models. For example, the classifications True Positive,
False Positive, True Negative, and False Negative count cases in partitions where the
predicted probability is greater than your accuracy threshold and the predicted state
matches the target state.
You can see in Figure 10 that the True Positive classification of Decision Trees does not
give you very consistent results across partitions. The third partition has approximately
25 percent less True Positive scores than the first two partitions. The True Positive
classification counts cases predicted as positive (bike buyers, in the example) that are
actually positive. In addition, the standard deviation of this measure is quite high.
However, when checking the Neural Network model, which Figure 11 shows, you can
see that it is more consistent for the True Positive classification, which means that this
model is more robust on different data sets than the Decision Trees model.
Figure 11: Cross-validation of predictive models—Neural Network
437
SQL Server 2012 Upgrade Technical Guide
From the cross-validation results, it seems that you should deploy the Neural Network
model in production. Although the accuracy of the Neural Network model is slightly
lower than that of the Decision Trees model, the reliability is higher. Of course, in
production, you should perform many additional accuracy and reliability tests before
deciding which model to deploy. But testing the reliability of predictive models is one
of the most important post-upgrade tasks when you upgrade to SSAS 2012. To learn
more about cross-validation, see
Cross-Validation (Analysis Services – Data Mining)
(http://msdn.microsoft.com/en-us/library/bb895174(SQL.110).aspx) in SQL Server 2012
Books Online.
Model Filtering
In SSAS 2005, you have to create a different mining structure if you want to use just a
subset of data for an additional mining model. In SSAS 2008, 2008 R2, and 2012, you
can filter a specific model to use only a subset of data for training. For example, using
the same structure, you can create a model trained on the complete training set,
another one trained only on the female population subset, and the third one trained
only on the male population subset. You can then compare the performance of the
models trained on the complete population with those trained on the various subsets.
If you used different structures for subsets of training data in SSAS 2005, you should
consider consolidating those structures into one structure in SSAS 2012 so that you can
compare the performance of the models in a single Lift Chart or with a single cross-
validation. To learn more about model filtering, see
Filters for Mining Models (Analysis
Services - Data Mining)
(http://msdn.microsoft.com/en-
us/library/bb895167(SQL.110).aspx) in SQL Server 2012 Books Online.
Measuring Quality of Time Series Algorithm
How can you measure the quality of forecasted values with the Time Series algorithm
when you do not have the actual data yet? Waiting until the data is available is likely
not practical because by that time, you might already have made wrong decisions
based on your forecasting model. There is a better way to measure the performance of
the Time Series model. Using a specific number of periods from the past, you can try to
forecast present values. If the model performs well for forecasting present values,
probability is good that it will perform well for forecasting future values.
You control the creation of historical models by using two algorithm parameters:
HISTORICAL_MODEL_COUNT and HISTORICAL_MODEL_GAP. The first one controls the
number of historical models that will be built, and the second one controls the number
of time slices between historical models.
Dostları ilə paylaş: |