IPredictorClient::Predict Method [C++]

Use this method to generate predictions that are used to recommend relevant products to a user, the current case, or to fill in missing profile data associated with the user.

Definition

[C++]

HRESULT IPredictorClient::Predict(IDictionary*dCurrentCase,
  ISimpleList*slPropsToPredict,
  VARIANT*pvsavPredictedPropsVARIANT*pvsavPredictedValslonglMaxPredictions,
  VARIANT*pvsavDetails);

[Visual Basic]

Sub Predict(dCurrentCase As Object,
  slPropsToPredict As Object,
  pvsavPredictedPropsAs VariantpvsavPredictedValsAs VariantOptional lMaxPredictions As LongOptional pvsavDetailsAs Variant)

Parameters

  • dCurrentCase[C++]
    [in] A pointer to the IDictionary interface of a Dictionary object that contains the current case. The case is data about the user is in the form of property/value pairs.
  • dCurrentCase[Visual Basic]
    A Dictionary object that contains the current case. The case is data about the user is in the form of property/value pairs.
  • slPropsToPredict[C++]
    [in] A pointer to the ISimpleList interface of a SimpleList object that contains the names of the properties to predict.
  • slPropsToPredict[Visual Basic]
    A SimpleList object that contains the names of the properties to predict.
  • pvsavPredictedProps[C++]
    [out] A pointer to a VARIANT used to return a SAFEARRAY containing the predicted property names.
  • pvsavPredictedProps[Visual Basic]
    A Variant used to return a SafeArray containing the predicted property names.
  • pvsavPredictedVals[C++]
    [out] A pointer to a VARIANT used to return a SAFEARRAY containing the predicted property values.
  • pvsavPredictedVals[Visual Basic]
    A Variant used to return a SafeArray containing the predicted property values.
  • lMaxPredictions[C++]
    [in, optional, defaultvalue (-1)] A long that specifies the maximum number of predictions to return. The default value indicates to return all predictions.
  • lMaxPredictions[Visual Basic]
    A Long that specifies the maximum number of predictions to return. The default value of -1 indicates to return all predictions.
  • pvsavDetails[C++]
    [out, optional] A pointer to a VARIANT used to return a SafeArray containing the probabilities for a property having a value.
  • pvsavDetails[Visual Basic]
    A Variant used to return a SafeArray containing the probabilities for a property having a value.

Return Values

[C++] This method returns an HRESULT indicating whether it completed successfully. See the Error Values section for more details.

[Visual Basic] None.

Error Values

[C++] This method returns S_OK (0x00000000) to indicate success and standard COM HRESULT error values to indicate failure. For more information about standard COM errors, see Standard COM Errors. Additional information may be available using the global Err object, which can be accessed using the API function GetErrorInfo. In particular, the GetDescription method of the IErrorInfo interface may return a text description of the error.

[Visual Basic] This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to standard COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors. Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

Remarks

Predictions are made using the currently loaded prediction model based on user profile and selection information contained in the current case. The predicted property/value pairs are returned sorted in descending order of likelihood.

Set the fpDefaultConfidence and fpPopularityPenalty properties and load the prediction model using the LoadModelFromDB or LoadModelFromFile methods before using the Predict method.

Default values for the fpDefaultConfidence and fpPopularityPenalty properties may be set in the Application_OnStart method in the global.asa file to avoid having to explicitly set the values for every Predict method call.

The slPropsToPredict parameter is a SimpleList object that can contain either high level properties for example, SKU, or low level properties for example, QTY(sku1). Using low-level properties makes the prediction process a lot faster.

For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.

[Visual Basic]

Example

' dCase is a Dictionary object, slPropsToPredict is a SimpleList
' vsavPredictedProps, vsavPredictedValues are Variant SafeArrays
oPredictorClient.Predict dCase, slPropsToPredict, vsavPredictedProps, _
 vsavPredictedVals, 10

See Also

[C++]PredictorClient Object

[C++]IPredictorClient::LoadModelFromFile

[C++]IPredictorClient::LoadModelFromDB

[C++]IPredictorClient::get_fpDefaultConfidence, put_fpDefaultConfidence

[Visual Basic]PredictorClient Object

[Visual Basic]PredictorClient.LoadModelFromFile

[Visual Basic]PredictorClient.LoadModelFromDB

[Visual Basic]PredictorClient.fpDefaultConfidence

Copyright © 2005 Microsoft Corporation.
All rights reserved.