Mining Structures

This section provides comprehensive documentation on mining structures in SQL Server Analysis Services (SSAS). Mining structures are the foundation for all data mining tasks in SSAS. They define the data that will be used for mining, including the prediction sources and related attributes.

What is a Mining Structure?

A mining structure in SSAS is a metadata object that defines the data to be analyzed by a data mining algorithm. It acts as a container for:

Key Components of a Mining Structure

1. Data Sources

The data source view defines the source of data for the mining structure. This can be a relational database, a data warehouse, or any other data source supported by SSAS.

2. Columns

Each column in the mining structure represents an attribute from the source data. You must specify the following properties for each column:

3. Partitions

Partitions allow you to divide your data into subsets for training and testing. This is crucial for evaluating the performance and accuracy of your mining models.

4. Mining Models

A mining structure can contain multiple mining models, each built using a different algorithm or configuration. This allows you to compare the results of various mining techniques on the same data.

Pro Tip: Carefully select and define your columns' usage and content types. Incorrect configurations can lead to inaccurate or inefficient mining models.

Creating a Mining Structure

You can create mining structures using SQL Server Data Tools (SSDT) for Visual Studio. The process typically involves:

  1. Creating a new Analysis Services project.
  2. Adding a Data Source View.
  3. Creating a new Mining Structure.
  4. Configuring the columns and their properties.
  5. Selecting the mining algorithms you want to use.

Example

Consider a customer churn prediction scenario. Your mining structure might include:

You would then build mining models (e.g., Decision Trees, Logistic Regression) on this structure to predict which customers are likely to churn.


-- Example SQL query to select data for a mining structure (conceptual)
SELECT
    CustomerID,
    Age,
    Gender,
    MonthlyCharges,
    ContractType,
    Tenure,
    SupportCalls,
    ChurnStatus
FROM
    CustomerData
WHERE
    CustomerID IS NOT NULL AND ChurnStatus IS NOT NULL;
            

Further Reading