Code to Load a Model and Set Default Properties
This code is placed in the Global.asa file. The properties are set here to avoid explicitly setting the values for every Predict method call.
Create a PredictorClient object.
Dim oPredictorClient Set oPredictorClient = Server.CreateObject("Commerce.PredictorClient")
Using the connection string, sDWConnect, retrieved in Code to Retrieve the Database Connection String, load the Purchase1 model created in Code to Build a New Model.
oPredictorClient.LoadModelFromDB "Purchase1", sDWConnect
Set the properties. The bFailOnUnknownInputAttributes property is set to True while debugging the application. This forces the Predict method to fail when information passed to the method is not recognized by the currently loaded model.
oPredictorClient.bFailOnUnknownInputAttributes = True oPredictorClient.fpDefaultConfidence = 95 oPredictorClient.fpPopularityPenalty = 0.2
Associate the PredictorClient object with the site to allow performance monitoring to be aggregated over the site.
oPredictorClient.sSiteName = "Retail"
Release the object.
Set oPredictorClient = Nothing