Other Uses of Predictor

When the Predictor object is used to suggest specific products, it uses the product SKU as the basis of its predictions. However, the Predictor is by no means limited to the concept of a SKU.

In some situations, a SKU may be too specific an identifier to use as the basis for predictions. For example, the Volcano Coffee sample store offers a dress shirt in a variety of colors and sizes. The dress shirt itself is assigned a product family id (pfID), while each combination of size and color is designated with a separate SKU comprised of the pfID and the attribute IDs. To best implement the Predictor in the Volcano Coffee application, the pfID, rather than the SKU, should be used as the basis for predictions.

The basis for prediction can extend beyond products and departments. For example, a site that sells music CDs and tapes could base predictions on recording artists. Using the Predictor, the site could correlate customer musical preferences and suggest other artists that the customer might enjoy. Another site could keep track of the URLs that a user has visited, and suggest other pages to that visitor.

You can use any type of identifier as the basis for predictions, either numbers or strings. However, you must ensure the following:

To use a prediction identifier other than the SKU, you must make sure that this identifier is logged to the site purchase history and that the prediction results are displayed in a way that is appropriate. If you are using the Microsoft Press sample site as a starting point for implementing a site using Predictor, perform the following steps to use a prediction identifier other than the SKU.

  1. Make sure that the prediction identifier exists in the order form object when the Payment stage of the Purchase pipeline configuration is executed. If the prediction identifier is not already available, write a Scriptor component to synthesize the identifier from other values and write the result into the order form object.
  2. If necessary, modify the database schema for the site purchase history table. In Microsoft Press, the site purchasing history table (mspress30_predictor_data) contains a varchar column named sku, whose width is 30 characters. Change the name and width as needed.
  3. Using the Commerce Server Pipeline Editor, open the Purchase.pcf configuration file. In the Accept stage, open the component labeled SQLItemADO (Predictor data). This component writes values into the site purchasing history table whenever purchases are made. On the property pages for this component, select the SQL Item (ADO) tab. Change the item.sku parameter to the name of the property in the order form to use as the prediction identifier.
  4. If you have changed the name of the column that specifies the prediction identifier in the site purchasing history database, then open the site’s Global.asa file for editing. Locate the call to the InitPredictor method, and change the name of the SkuColumn argument from "sku" to the new name of the column. This will initialize the Predictor object correctly based on the site purchasing history.
  5. On the page where you want to list prediction results, pass the prediction identifier instead of the SKU to the GetPredictions method. The prediction identifier is passed in a SimpleList containing Dictionary objects. The name of this property must remain sku because that name is expected by the GetPredictions method.
  6. On the same page, design the display of prediction results so that it uses the prediction identifiers that are returned by GetPredictions. For example, if you have used pfID as the prediction identifier, then design the results display to show product families. In the Dictionary object that is returned, the name of the value containing the suggested prediction identifier is sku, regardless of the type of prediction identifier that you actually used.

© 1997-1998 Microsoft Corporation. All rights reserved.