- •Contents
- •Data Mining Tutorials (Analysis Services)
- •Basic Data Mining Tutorial
- •Lesson 1: Preparing the Analysis Services Database (Basic Data Mining Tutorial)
- •Creating an Analysis Services Project (Basic Data Mining Tutorial)
- •Creating a Data Source (Basic Data Mining Tutorial)
- •Creating a Data Source View (Basic Data Mining Tutorial)
- •Lesson 2: Building a Targeted Mailing Structure (Basic Data Mining Tutorial)
- •Creating a Targeted Mailing Mining Model Structure (Basic Data Mining Tutorial)
- •Specifying the Data Type and Content Type (Basic Data Mining Tutorial)
- •Specifying a Testing Data Set for the Structure (Basic Data Mining Tutorial)
- •Lesson 3: Adding and Processing Models
- •Adding New Models to the Targeted Mailing Structure (Basic Data Mining Tutorial)
- •Processing Models in the Targeted Mailing Structure (Basic Data Mining Tutorial)
- •Lesson 4: Exploring the Targeted Mailing Models (Basic Data Mining Tutorial)
- •Exploring the Decision Tree Model (Basic Data Mining Tutorial)
- •Exploring the Clustering Model (Basic Data Mining Tutorial)
- •Exploring the Naive Bayes Model (Basic Data Mining Tutorial)
- •Lesson 5: Testing Models (Basic Data Mining Tutorial)
- •Testing Accuracy with Lift Charts (Basic Data Mining Tutorial)
- •Testing a Filtered Model (Basic Data Mining Tutorial)
- •Lesson 6: Creating and Working with Predictions (Basic Data Mining Tutorial)
- •Creating Predictions (Basic Data Mining Tutorial)
- •Using Drillthrough on Structure Data (Basic Data Mining Tutorial)
- •Lesson 1: Creating the Intermediate Data Mining Solution (Intermediate Data Mining Tutorial)
- •Creating a Solution and Data Source (Intermediate Data Mining Tutorial)
- •Lesson 2: Building a Forecasting Scenario (Intermediate Data Mining Tutorial)
- •Adding a Data Source View for Forecasting (Intermediate Data Mining Tutorial)
- •Creating a Forecasting Structure and Model (Intermediate Data Mining Tutorial)
- •Modifying the Forecasting Structure (Intermediate Data Mining Tutorial)
- •Customizing and Processing the Forecasting Model (Intermediate Data Mining Tutorial)
- •Exploring the Forecasting Model (Intermediate Data Mining Tutorial)
- •Creating Time Series Predictions (Intermediate Data Mining Tutorial)
- •Advanced Time Series Predictions (Intermediate Data Mining Tutorial)
- •Lesson 3: Building a Market Basket Scenario (Intermediate Data Mining Tutorial)
- •Adding a Data Source View with Nested Tables (Intermediate Data Mining Tutorial)
- •Creating a Market Basket Structure and Model (Intermediate Data Mining Tutorial)
- •Modifying and Processing the Market Basket Model (Intermediate Data Mining Tutorial)
- •Exploring the Market Basket Models (Intermediate Data Mining Tutorial)
- •Filtering a Nested Table in a Mining Model (Intermediate Data Mining Tutorial)
- •Predicting Associations (Intermediate Data Mining Tutorial)
- •Lesson 4: Building a Sequence Clustering Scenario (Intermediate Data Mining Tutorial)
- •Creating a Sequence Clustering Mining Model Structure (Intermediate Data Mining Tutorial)
- •Processing the Sequence Clustering Model
- •Exploring the Sequence Clustering Model (Intermediate Data Mining Tutorial)
- •Creating a Related Sequence Clustering Model (Intermediate Data Mining Tutorial)
- •Creating Predictions on a Sequence Clustering Model (Intermediate Data Mining Tutorial)
- •Lesson 5: Building Neural Network and Logistic Regression Models (Intermediate Data Mining Tutorial)
- •Adding a Data Source View for Call Center Data (Intermediate Data Mining Tutorial)
- •Creating a Neural Network Structure and Model (Intermediate Data Mining Tutorial)
- •Exploring the Call Center Model (Intermediate Data Mining Tutorial)
- •Adding a Logistic Regression Model to the Call Center Structure (Intermediate Data Mining Tutorial)
- •Creating Predictions for the Call Center Models (Intermediate Data Mining Tutorial)
- •Creating and Querying Data Mining Models with DMX: Tutorials (Analysis Services - Data Mining)
- •Bike Buyer DMX Tutorial
- •Lesson 1: Creating the Bike Buyer Mining Structure
- •Lesson 2: Adding Mining Models to the Bike Buyer Mining Structure
- •Lesson 3: Processing the Bike Buyer Mining Structure
- •Lesson 4: Browsing the Bike Buyer Mining Models
- •Lesson 5: Executing Prediction Queries
- •Market Basket DMX Tutorial
- •Lesson 1: Creating the Market Basket Mining Structure
- •Lesson 2: Adding Mining Models to the Market Basket Mining Structure
- •Lesson 3: Processing the Market Basket Mining Structure
- •Lesson 4: Executing Market Basket Predictions
- •Time Series Prediction DMX Tutorial
- •Lesson 1: Creating a Time Series Mining Model and Mining Structure
- •Lesson 2: Adding Mining Models to the Time Series Mining Structure
- •Lesson 3: Processing the Time Series Structure and Models
- •Lesson 4: Creating Time Series Predictions Using DMX
- •Lesson 5: Extending the Time Series Model
Lesson 2: Adding Mining Models to the Bike Buyer Mining Structure
In this lesson, you will add two mining models to the Bike Buyer mining structure that you created Lesson 1: Creating the Bike Buyer Mining Structure. These mining models will allow you to explore the data using one model, and to create predictions using another.
To explore how potential customers can be categorized by their characteristics, you will create a mining model based on the Microsoft Clustering Algorithm. In a later lesson, you will explore how this algorithm finds clusters of customers who share similar characteristics. For example, you might find that certain customers tend to live close to each other, commute by bicycle, and have similar education backgrounds. You can use these clusters to better understand how different customers are related, and to use the information to create a marketing strategy that targets specific customers.
To predict whether a potential customer is likely to buy a bicycle, you will create a mining model based on the Microsoft Decision Trees Algorithm. This algorithm looks through the information that is associated with each potential customer, and finds characteristics that are useful in predicting if they will buy a bicycle. It then compares the values of the characteristics of previous bike buyers against new potential customers to determine whether the new potential customers are likely to buy a bicycle.
ALTER MINING STRUCTURE Statement
In order to add a mining model to the mining structure, you use the ALTER MINING STRUCTURE (DMX) statement. The code in the statement can be broken into the following parts:
•Identifying the mining structure
•Naming the mining model
•Defining the key column
•Defining the input and predictable columns
•Identifying the algorithm and parameter changes
The following is a generic example of the ALTER MINING MODEL statement:
ALTER MINING STRUCTURE [<mining structure name>] ADD MINING MODEL [<mining model name>]
(
[<key column>], <mining model columns>,
) USING <algorithm name>( <algorithm parameters> ) WITH FILTER (<expression>)
The first line of the code identifies the existing mining structure to which the mining models will be added:
154
ALTER MINING STRUCTURE [<mining structure name>]
The next line of the code names the mining model that will be added to the mining structure:
ADD MINING MODEL [<mining model name>]
For information about naming an object in DMX, see Identifiers (DMX).
The next lines of the code define columns from the mining structure that will be used by the mining model:
[<key column>], <mining model columns>
You can only use columns that already exist in the mining structure, and the first column in the list must be the key column from the mining structure.
The next line of the code defines the mining algorithm that generates the mining model and the algorithm parameters that you can set on the algorithm:
) USING <algorithm name>( <algorithm parameters> )
For more information about the algorithm parameters that you can adjust, see Microsoft Decision Trees Algorithm and Microsoft Clustering Algorithm.
You can specify that a column in the mining model be used for prediction by using the following syntax:
<mining model column> PREDICT
The final line of the code, which is optional, defines a filter that is applied when training and testing the model. For more information about how to apply filters to mining models, see Creating Filters for Mining Models (Analysis Services - Data Mining).
Lesson Tasks
You will perform the following tasks in this lesson:
•Add a decision tree mining model to the Bike Buyer structure by using the Microsoft Decision Trees algorithm
•Add a clustering mining model to the Bike Buyer structure by using the Microsoft Clustering algorithm
•Because you want to see results for all cases, you will not yet add a filter to either model.
Adding a Decision Tree Mining Model to the Structure
The first step is to add a mining model based on the Microsoft Decision Trees algorithm.
To add a decision tree mining model
1.In Object Explorer, right-click the instance of Analysis Services, point to New Query, and then click DMX to open Query Editor and a new, blank query.
2.Copy the generic example of the ALTER MINING STRUCTURE statement into the
155
blank query.
3. Replace the following:
<mining structure name> with:
[Bike Buyer]
4. Replace the following:
<mining model name> with:
Decision Tree
5. Replace the following:
<mining model columns>, with:
(
CustomerKey,
[Age],
[Bike Buyer] PREDICT,
[Commute Distance], [Education], [Gender],
[House Owner Flag],
[Marital Status], [Number Cars Owned],
[Number Children At Home], [Occupation],
[Region],
[Total Children],
[Yearly Income]
In this case, the [Bike Buyer] column has been designated as the PREDICT column.
6. Replace the following:
USING <algorithm name>( <algorithm parameters> ) with:
Using Microsoft_Decision_Trees WITH DRILLTHROUGH
156
The WITH DRILLTHROUGH statement allows you to explore the cases that were used to build the mining model.
The resulting statement should now be as follows:
ALTER MINING STRUCTURE [Bike Buyer] ADD MINING MODEL [Decision Tree]
(
CustomerKey,
[Age],
[Bike Buyer] PREDICT,
[Commute Distance], [Education], [Gender],
[House Owner Flag],
[Marital Status], [Number Cars Owned],
[Number Children At Home], [Occupation],
[Region],
[Total Children],
[Yearly Income]
) USING Microsoft_Decision_Trees WITH DRILLTHROUGH
7.On the File menu, click Save DMXQuery1.dmx As.
8.In the Save As dialog box, browse to the appropriate folder, and name the file
DT_Model.dmx.
9.On the toolbar, click the Execute button.
Adding a Clustering Mining Model to the Structure
You can now add a mining model to the Bike Buyer mining structure based on the Microsoft Clustering algorithm. Because the clustering mining model will use all the columns defined in the mining structure, you can use a shortcut to add the model to the structure by omitting the definition of the mining columns.
To add a Clustering mining model
1.In Object Explorer, right-click the instance of Analysis Services, point to New Query, and then click DMX to open Query Editor opens and a new, blank query.
157