Model Evaluation

Microsoft SQL Server Analysis Services - Data Mining

Introduction to Model Evaluation

Evaluating the performance of your data mining models is a critical step in the data mining lifecycle. It allows you to understand how well your model predicts outcomes, identify its strengths and weaknesses, and compare it against alternative models or baseline scenarios. Analysis Services provides a rich set of tools and metrics for model evaluation.

Why Evaluate Models?

Key Evaluation Metrics

Classification Models

For classification models, common evaluation metrics include:

Clustering Models

For clustering models, evaluation often focuses on:

Regression Models

For regression models, key metrics include:

Using Analysis Services for Evaluation

DMX Queries

You can use Data Mining Extensions (DMX) queries to retrieve prediction results and calculate custom metrics.

SELECT
    [Customer],
    [Predicted <Customer> Buy],
    [CAST([Customer] AS FLOAT) = [Predicted <Customer> Buy]] AS CorrectPrediction
FROM
    [MyPredictionQuery]
PREDICTION JOIN
    [MyCustomerTable] ON [MyCustomerTable].[Customer] = [MyPredictionQuery].[Customer]
WHERE
    [MyCustomerTable].[CustomerID] = 12345;

SQL Server Management Studio (SSMS) Tools

SSMS provides graphical tools for model evaluation:

Tip: Always evaluate your model on a separate test dataset that was not used during training to get an unbiased estimate of its performance.

Cross-Validation

Cross-validation is a powerful technique to assess how a model generalizes to an independent dataset. Analysis Services supports cross-validation, allowing you to divide your data into multiple folds, train the model on a subset of folds, and test it on the remaining fold. This process is repeated multiple times, and the results are averaged to provide a more robust evaluation.

Best Practice: When evaluating models, consider both statistical metrics and their business implications. A model with slightly lower statistical accuracy might be preferred if it provides more actionable insights or is more efficient to implement.

Further Reading