Mining Structure Objects
The mining structure is the top‑level container for a data mining solution in SQL Server Analysis Services. It defines the source data, the algorithm, and the characteristics of the model(s) that will be built.
Key Objects
| Object | Purpose | Typical Properties |
|---|---|---|
| Mining Structure | Encapsulates source data, algorithm selection, and processing settings. | Source view, Algorithm, Processing mode, Refresh schedule |
| Mining Model | Represents a trained model derived from the mining structure. | Model type, Mining column, Predictive columns, Settings |
| Mining Model Column | Defines a column used for training or prediction. | Data type, Role (Content, Predictable, etc.), Binning, Discretization |
| Mining Model Column Group | Groups related columns for easier management. | Group name, Member columns |
Creating a Mining Structure
Use SQL Server Data Tools (SSDT) or the Analysis Services project to add a mining structure:
1. Right‑click the Data Mining folder → New Mining Structure.
2. Select a source view (relational table or view).
3. Choose an algorithm (e.g., Microsoft Decision Trees, Neural Network, etc.).
4. Define the Content and Predictable columns.
5. Set processing options (Full, Incremental, or Real‑time).
Processing the Structure
After defining the structure, it must be processed to train the model(s):
ALTER MINING STRUCTURE [CustomerChurn] PROCESS;
Processing can be scheduled via SQL Server Agent or triggered programmatically.
Sample MDX Prediction Query
SELECT
PredictProbability([Predict CustomerChurn].[Churn]=1) AS Probability,
PredictValue([Predict CustomerChurn].[Churn]) AS PredictedValue
FROM
[CustomerChurn]
NATURAL PREDICTION JOIN
(
SELECT
[Gender].[Male] AS Gender,
45 AS Age,
1200 AS MonthlyCharges
) AS T;