MSDN Documentation

Microsoft Developer Network

Mining Model for Prediction

This document provides a comprehensive overview of how to create and use mining models for prediction in SQL Server Analysis Services (SSAS). Predictive mining models are designed to forecast future events or values based on historical data. This involves selecting an appropriate mining algorithm, defining the mining structure, and then training the model.

Understanding Predictive Models

Predictive models help answer questions like:

Common algorithms used for prediction include Linear Regression, Logistic Regression, Decision Trees, and Neural Networks.

Creating a Predictive Mining Model

The process typically involves the following steps:

  1. Define the Mining Structure: This involves specifying the data source, selecting columns (predictable and content), and choosing the appropriate mining algorithm.
  2. Train the Model: Using the defined structure and historical data, SSAS trains the algorithm to identify patterns and relationships.
  3. Browse and Inspect the Model: Once trained, you can visualize the model to understand its logic and identify key influencing factors.
  4. Make Predictions: Use the trained model to predict outcomes for new or existing data.

Example: Predicting Customer Churn

Let's consider predicting customer churn. We might use a Decision Tree algorithm. The predictable column would be a binary indicator of whether a customer has churned or not.

The mining structure would include demographic information, usage patterns, customer service interactions, and contract details as content columns.

DMX for Prediction

Data Mining Extensions (DMX) is a query language used with SSAS. Here's a basic example of how to predict churn probability for a specific customer:


SELECT
    [Customer].[CustomerID],
    [TargetMail].[PROBABILITY(1)] AS ChurnProbability
FROM
    [MyPredictionModel]
PREDICTION JOIN
    OPENQUERY(AdventureWorksDW,
        'SELECT CustomerID FROM DimCustomer WHERE CustomerID = 12345'
    )
    AS t ON [MyPredictionModel].[CustomerID] = t.CustomerID
            
Note: Ensure your data source is clean and relevant for accurate predictions. Feature engineering can significantly improve model performance.

Model Evaluation

After training, it's crucial to evaluate the model's accuracy and effectiveness. SSAS provides tools and metrics for this purpose, such as confusion matrices, accuracy charts, and lift charts.

Key Considerations

Tip: Experiment with different algorithms and parameters to find the optimal model for your specific prediction task.

Related Topics