Mining Model Prediction


All this training and testing has finally gotten us to a place where we have a mining model ready to make real-world predictions. We have seen how each of the mining models does at making predictions; now, we can pick one and put it to work. The Mining Model Prediction tab enables us to do just that.

Using the Mining Model Prediction tab, we can create queries that use a mining model to make predictions. Two types of prediction queries are supported: a singleton query and a prediction join. We look at the singleton query first.

A Singleton Query

A singleton query lets us feed a single set of input values to the mining model. We receive a single value for the predictable based on these values. This enables us to manually enter a scenario to see what the mining model will predict.

Creating a Singleton Query

For both the singleton query and the prediction join, we must first select the mining model to use. When the model is selected, the Singleton Query Input dialog box contains an input field for each input column in the mining model. We can then enter values for each of these input columns.

We then select the columns we would like in the result set. The predictable column should be included in the result set; otherwise, the query isn't doing much for us. We can also include our own custom expressions, as desired.

When the query is designed, we switch to the result view to see the result set. We can also switch to the SQL view to see the DMX query being created for us behind the scenes. More on that in the section "Data Mining Extensions." Queries can be saved to be rerun at a later time.

Learn By Doing—Creating a Singleton Query

Feature Highlighted
  • Creating a singleton query using the Mining Model Prediction tab

Business Need Our business need is simple. We will try out the mining model we have worked so hard to create.

Steps
  1. Open the Business Intelligence Development Studio.

  2. Open the MaxMinSalesDM project.

  3. If the Data Mining Design tab for the Classification - Children At Home data mining structure is not displayed, double-click the entry for this data mining structure in the Solution Explorer window.

  4. Select the Mining Model Prediction tab on the Data Mining Design tab.

  5. Click the Singleton Query button in the Mining Model Prediction tab toolbar. This is shown in Figure 14-14.

  6. Click Select Model in the Mining Model window. The Select Mining Model dialog box appears as shown in Figure 14-15.

  7. Select the Neural Network - Children At Home mining model and click OK.

  8. In the Singleton Query Input window, select Y from the Houseowner drop-down list in the Value column. Select N from the Marital Status drop-down list. Select 2 from the Num Cars Owned drop-down list.

  9. Now select the columns in the result set. In the first row under the Source column, select Neural Network - Children At Home mining model from the drop-down list. This is shown in Figure 14-16. NUM Children At Home is selected by default in the Field column because it is the only predictable in the mining model.

  10. In the second row under the Source column, select Custom Expression from the drop-down list.

  11. In the second row under the Field column, enter the following:

     'Houseowner=Y; Marital Status=N; Num Cars Owned=2' 

  12. In the second row under the Alias column, enter InputCriteria. The Mining Model Prediction tab appears as shown in Figure 14-17.

  13. Select Result from the View drop-down list in the Mining Model Prediction tab toolbar as shown in Figure 14-18.

  14. The result view is displayed as shown in Figure 14-19. The model predicts that someone who is a homeowner, is not married, and owns two cars will most likely have four children at home.

  15. Select Design from the View drop-down list in the Mining Model Prediction tab toolbar to return to the design view.

image from book
Figure 14-14: The Singleton Query toolbar button

image from book
Figure 14-15: The Select Mining Model dialog box

image from book
Figure 14-16: Selecting the columns in the singleton query result set

image from book
Figure 14-17: The completed singleton query

image from book
Figure 14-18: Selecting the result view

image from book
Figure 14-19: The singleton query result set in the result view

A Prediction Join Query

The singleton query lets us use a single set of inputs to generate a single row result set. The prediction join query enables us to use a table-full of inputs to generate a multiple row result set. We feed multiple records to the mining model and it creates a prediction for each of these records.

Creating a Prediction Join Query

The prediction join query functions similarly to the singleton query: the difference is that the Singleton Query Input window is replaced by the Select Input Table(s) window. This window lets us select the table or joined set of tables that will serve as the record source for the prediction join. The Select Input Table(s) window functions in the same manner as the Select Input Table(s) window on the Mining Accuracy Chart—Column Mapping tab.

Learn By Doing—Creating a Prediction Join Query

Feature Highlighted
  • Creating a prediction join query using the Mining Model Prediction tab

Business Need In a previous Learn By Doing exercise, we discussed a scenario where the Maximum Miniatures Marketing Department purchased a mailing list that they wanted classified into those households likely to have no children at home and those that have one or more children at home. We now have a trained and tested mining model ready to perform that classification.

To keep things simple, we can use the same customer table and a little imagination to pretend this is the newly purchased list. Remember, the whole reason we had to do this classification was because the newly purchased list did not include the number of children at home. Therefore, if we are having our existing customer table play the role of the newly purchased list, we must ignore the fact it already has a number of children at home field.

Steps
  1. Click the Singleton Query button in the Mining Model Prediction tab toolbar to toggle back to the Prediction Join Query mode. Click Yes to continue when warned about losing your query.

  2. Click Select Case Table in the Select Input Table(s) window. The Select Table dialog box appears.

  3. Select the Customer (MaxMinSalesDM) table and click OK.

  4. The fields are automatically mapped, based on field names.

  5. We are not supposed to have a Num Children At Home field in this table, so we need to delete this mapping and predict this value instead. Scroll down until the Num_Children_At_Home field is visible.

  6. Click the mapping line going to this field, so it is highlighted.

  7. Right-click the mapping line and select Delete from the Context menu.

  8. In the first row under the Source column, select Neural Network - Children At Home mining model from the drop-down list. Again, Num Children At Home is selected by default in the Field column because it is the only predictable in the mining model.

  9. In the second row under the Source column, select Customer Table from the drop-down list.

  10. In the second row under the Field column, select Fname from the drop-down list.

  11. In the third row under the Source column, select Customer Table from the drop-down list.

  12. In the third row under the Field column, select Lname from the drop-down list.

  13. Continue this process to include Address 1, City, State_Province, and Postal_Code in the result set. The Mining Model Prediction tab appears as shown in Figure 14-20.

  14. Select Result from the View drop-down list in the Mining Model Prediction tab toolbar.

  15. The result view is displayed as shown in Figure 14-21.

  16. One issue remains. The Marketing Department only wants to mail to households that are predicted to have no children at home. All of the others should be eliminated from the list. Select Design from the View drop-down list in the Mining Model Prediction tab toolbar to return to the design view.

  17. In the first row under the Criteria/Argument column, enter = 0.

  18. We do not need to see the predictable value in our result set, especially now that it will be 0 for every row. Uncheck the check box in the first row of the Show column. The Mining Model Prediction tab appears as shown in Figure 14-22.

  19. Select Result from the View drop-down list in the Mining Model Prediction tab toolbar. Now only those households predicted to have no children at home are included in our result set as shown in Figure 14-23.

  20. Now we need to place this result set somewhere where it can be used for the mailing. Click the Save button in the Mining Model Prediction tab toolbar. The Save Data Mining Query Result dialog box appears.

  21. We save the query result set to a table in the Max Min Sales DM data source. Enter MythicWorldMailing for Table Name. We can choose to add the table to a data source view, if desired, but we do not need to do that here. The Save Data Mining Query Result dialog box appears as shown in Figure 14-24.

    Note 

    Saving a table such as this one to a data mart database is probably not a great idea, because it is being created for a one-time mailing, not for ongoing analysis. We do this here for demonstration purposes only!

  22. Click Save. A table called MythicWorldMailing is created in the MaxMinSalesDM database and all the rows of the result set are inserted into that table.

  23. Select Query from the View drop-down list in the Mining Model Prediction tab toolbar. The query appears as shown in Figure 14-25. This is the DMX query you created using the graphical tools. We learn more about DMX in the following section.

image from book
Figure 14-20: The completed prediction join query

image from book
Figure 14-21: The prediction join query result set in the result view

image from book
Figure 14-22: The prediction join query with filter criteria

image from book
Figure 14-23: The prediction join query result set with filter criteria

image from book
Figure 14-24: The save data mining query result dialog box

image from book
Figure 14-25: A DMX prediction join query




Delivering Business Intelligence with Microsoft SQL Server 2005
Delivering Business Intelligence with Microsoft SQL Server 2005: Utilize Microsofts Data Warehousing, Mining & Reporting Tools to Provide Critical Intelligence to A
ISBN: 0072260904
EAN: 2147483647
Year: 2007
Pages: 112
Authors: Brian Larson

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net