Creating a Neural Network Structure and Model (Intermediate Data Mining Tutorial)
To create a data mining model, you must first use the Data Mining Wizard to create a new mining structure based on the new data source view. In this task you will use the wizard to create a mining structure, and at the same time create an associated mining model that is based on the Microsoft Neural Network algorithm.
Because neural networks are extremely flexible and can analyze many combinations of inputs and outputs, you should experiment with several ways of processing the data to get the best results. For example, you might want to customize the way that data is binned, or grouped, to target specific business requirements. To do this, you will add a new column to the mining structure that groups numerical data in a different way, and then create a model that uses the new column. You will use these mining models to do some exploration.
Finally, when you have learned from the neural network model which factors have the greatest impact for your business question, you will build a separate model for prediction and scoring. You will use the Microsoft Logistic Regression algorithm, which is based on the neural networks model but is optimized for finding a solution based on specific inputs.
Creating the Default Call Center Structure
To create the default neural network mining structure and model
In Solution Explorer in Business Intelligence Development Studio, right-click Mining Structures and select New Mining Structure.
On the Welcome to the Data Mining Wizard page, click Next.
On the Select the Definition Method page, verify that From existing relational database or data warehouse is selected, and then click Next.
On the Create the Data Mining Structure page, verify that the option Create mining structure with a mining model is selected.
Click the dropdown list for the option Which data mining technique do you want to use?, then select Microsoft Neural Networks.
Because the logistic regression models are based on the neural networks, you can reuse the same structure and add a new mining model.
Click Next.
The Select Data Source View page appears.
Under Available data source views, select Call Center, and click Next.
On the Specify Table Types page, select the Case check box next to the FactCallCenter table. Click Next.
On the Specify the Training Data page, select Key next to the column FactCallCenterID.
Select the Predict and Input check boxes.
Select the Key, Input, and Predict check boxes as shown in the following table:
Tables/Columns
Key/Input/Predict
AutomaticResponses
Input
AverageTimePerIssue
Input/Predict
Calls
Input
DateKey
Do not use
DayOfWeek
Input
FactCallCenterID
Key
IssuesRaised
Input
LevelOneOperators
Input/Predict
LevelTwoOperators
Input
Orders
Input/Predict
ServiceGrade
Input/Predict
Shift
Input
TotalOperators
Do not use
WageType
Input
On the Specify Columns' Content and Data Type page, verify that the grid contains the columns, content types, and data types as shown in the following table, and then click Next.
Columns
Content Type
Data Types
AutomaticResponses
Continuous
Long
AverageTimePerIssue
Continuous
Long
Calls
Continuous
Long
DayOfWeek
Discrete
Text
FactCallCenterID
Key
Long
IssuesRaised
Continuous
Long
LevelOneOperators
Continuous
Long
LevelTwoOperators
Continuous
Long
Orders
Continuous
Long
ServiceGrade
Continuous
Double
Shift
Discrete
Text
WageType
Discrete
Text
On the Create testing set page, clear the text box for the option, Percentage of data for testing. Click Next.
On the Completing the Wizard page, for the Mining structure name, type Call Center.
For the Mining model name, type Call Center Default NN, and then click Finish.
The Allow drill through box is disabled because you cannot drill through to data with neural network models.
In Solution Explorer, right-click the name of the data mining structure that you just created, and select Process.
Understanding Discretization
By default, when you create a neural network model that has a numeric predictable attribute, the Microsoft Neural Network algorithm treats the attribute as a continuous number. For example, the ServiceGrade attribute is a number that theoretically ranges from 0.00 (all calls are answered) to 1.00 (all callers hang up). In this data set, the values have the following distribution:
As a result, when you process the model the outputs might be grouped differently than you expect. For example, the default model, which uses clustering to find groups of values, divides ServiceGrade into ranges such as this one: 0.0748051948 - 0.09716216215. Although this grouping is mathematically accurate, such ranges might not be as meaningful to business users. To group the numerical values differently, you can create a copy or multiple copies of the numerical data column and specify how the data mining algorithm should process the values. For example, you might specify that the algorithm divide the values into no more than five bins.
Analysis Services provides a variety of methods for binning or processing numerical data. The following table illustrates the differences between the results when the output attribute ServiceGrade has been processed three different ways:
Treating it as a continuous number
Having the algorithm discretize the value by the best possible method, which happens to be clustering
Specifying that the numbers be binned by the Equal Areas method
Default model (continuous) |
Binned by clustering |
Binned by equal areas |
---|---|---|
VALUESUPPORT
Missing0
0.09875120
|
VALUESUPPORT
< 0.074805194834
0.0748051948 - 0.0971621621527
0.09716216215 - 0.1329729729539
0.13297297295 - 0.16749999997510
>= 0.16749999997510
|
VALUESUPPORT
< 0.0726
0.07 - 0.0022
0.09 - 0.1136
>= 0.1236
|
In this table, the VALUE column shows you how the continuous number has been handled, and the SUPPORT column shows you how many rows were found with that value, range, or value type. For more information about binning options, see Discretization Methods (Data Mining).
Note
You can obtain these statistics from the marginal statistics node of the model, after all the data has been processed. For more information about the marginal statistics node, see Mining Model Content for Neural Network Models (Analysis Services - Data Mining).
Alternatively, rather than using the numeric values, you could add a separate derived column that classifies the service grades into predefined target ranges, such as Best (ServiceGrade <= 0.05), Acceptable (0.10 > ServiceGrade > 0.05), and Poor (ServiceGrade >= 0.10).
Creating a Copy of a Column and Changing the Discretization Method
In Analysis Services data mining, you can easily change the way that numerical data is binned within a mining structure by adding a copy of the column containing the target data and changing the discretization method.
The following procedure describes how to make a copy of the mining column that contains the target attribute, ServiceGrade. You can create multiple copies of any column in a mining structure, including the predictable attribute.
You will then customize the grouping of the numeric values in the copied column, to reduce the complexity of the groupings. For this tutorial, you will use the Equal Areas method of discretization, and specify four buckets. The groupings that result from this method are fairly close to the target values of interest to your business users.
Note
During initial exploration of data, you can also experiment with various discretization methods, or try clustering the data first.
To create a customized copy of a column in the mining structure
In Solution Explorer, double-click the mining structure that you just created.
In the Mining Structure tab, click Add a mining structure column.
In the Select column dialog box, select ServiceGrade from the list in Source column, then click OK.
A new column is added to the list of mining structure columns. By default, the new mining column has the same name as the existing column, with a numerical postfix: for example, ServiceGrade 1. You can change the name of this column to be more descriptive. You will also specify the discretization method.
Right-click ServiceGrade 1 and select Properties.
In the Properties window, locate the Name property, and change the name to Call Center Binned NN.
A dialog box appears asking whether you want to make the same change to the name of all related mining model columns. Click No.
In the Properties window, locate the section Data Type and expand it if necessary.
Change the value of the property Content from Continuous to Discretized.
The following properties are now available. Change the values of the properties as shown in the following table:
Property
Default value
New value
DiscretizationMethod
Continuous
EqualAreas
DiscretizationBucketCount
No value
4
Note
The default value of DiscretizationBucketCount is actually 0, which means that the algorithm automatically determines the optimum number of buckets. Therefore, if you want to reset the value of this property to its default, type 0.
In Data Mining Designer, click the Mining Models tab.
Notice that when you add a copy of a mining structure column, the usage flag for the copy is automatically set to Ignore. This is because, when you add a copy of a column to a mining structure, you should not use the copy for analysis together with the original column, or the algorithm will find a strong correlation between the two columns that might obscure other relationships.
Adding a New Mining Model to the Mining Structure
Now that you have created a new grouping for the target attribute, you need to add a new mining model that uses the discretized column. When you are done, the CallCenter mining structure will have two mining models:
The mining model, Call Center Default NN, handles the ServiceGrade values as a continuous range.
The mining model, Call Center Binned NN, discretizes the ServiceGrade values into four distinct buckets.
To add a mining model based on the new discretized column
In Solution Explorer, right-click the mining structure that you just created, and select Open.
Click the Mining Models tab.
Click Create a related mining model.
In the New Mining Model dialog box, for Model name, type Call Center Binned NN. In the Algorithm name dropdown list, select Microsoft Neural Network.
In the list of columns contained in the new mining model, locate ServiceGrade, and change the usage from Predict to Ignore.
Similarly, locate ServiceGrade Binned, and change the usage from Ignore to Predict.
Ordinarily you cannot compare mining models that use different predictable attributes. However, in SQL Server 2008, you can create an alias for a mining model column. That is, you can rename the ServiceGrade Binned column inside the mining model so that it has the same name as the original column. You can then directly compare these two models in an accuracy chart, even though the data is discretized differently.
To add an alias for a mining structure column in a mining model
In the Mining Models tab, under Structure, select ServiceGrade Binned.
Note that the Properties window displays the properties of the object, ScalarMiningStructure column.
Under the column for the mining model, ServiceGrade Binned NN, click the cell corresponding to the column ServiceGrade Binned.
Note that now the Properties window displays the properties for the object, MiningModelColumn.
Locate the Name property, and change the value to ServiceGrade.
Locate the Description property and type Temporary column alias.
The Properties window should contain the following information:
Property
Value
Description
Temporary column alias
ID
ServiceGrade Binned
Modeling Flags
Name
Service Grade
SourceColumn ID
Service Grade 1
Usage
Predict
Click anywhere in the Mining Model tab.
The grid is updated to show the new temporary column alias, ServiceGrade, beside the column usage. The grid containing the mining structure and two mining models should look like the following:
Structure
Call Center Default NN
Call Center Binned NN
Microsoft Neural Network
Microsoft Neural Network
AutomaticResponses
Input
Input
AverageTimePerIssue
Predict
Predict
Calls
Input
Input
DayOfWeek
Input
Input
FactCallCenterID
Key
Key
IssuesRaised
Input
Input
LevelOneOperators
Input
Input
LevelTwoOperators
Input
Input
Orders
Input
Input
ServceGrade Binned
Ignore
Predict (ServiceGrade)
ServiceGrade
Predict
Ignore
Shift
Input
Input
Total Operators
Input
Input
WageType
Input
Input
Processing the Model
Finally, to ensure that the models you have created are comparable, you will set the seed parameter for both the default and binned models. Setting a seed value guarantees that each model starts processing the data from the same point.
Note
If you do not specify a numeric value for the seed parameter, SQL Server Analysis Services will generate a seed based on the name of the model. Because the neural network model and the logistic regression model have different names, you must set a seed value to ensure that they process data in the same order.
To specify the seed and process the models
In the Mining Model tab, right-click the column for the model named Call Center - LR, and select Set Algorithm Parameters.
In the row for the HOLDOUT_SEED parameter, click the empty cell under Value, and type 1. Click OK. Repeat this step for each model associated with the structure.
Note
The value that you choose as the seed does not matter, as long as you use the same seed for all related models.
In the Mining Models menu, select Process Mining Structure and All Models. Click Yes to deploy the updated data mining project to the server.
In the Process Mining Model dialog box, click Run.
Click Close to close the Process Progress dialog box, and then click Close again in the Process Mining Model dialog box.
Now that you have created the two related mining models, you will explore the data to discover relationships in the data.
Change History
Updated content |
---|
Updated tutorial scenario to use a single mining structure that contains multiple copies of the numeric column, with each column discretized differently. |
Added an explanation of how to use the column aliases in data mining models, |
Corrected the mining model names in predictions and DDL statements to match the updated scenario. |
Added the data types of content types for the new DayOfWeek column. |