Recommender Engine Action Set
Output Data Tables
The recKnn action creates three data tables in CAS, whose names you specify in the outModel, outSimilarity, and savestate parameters. The interpretation of the columns in the outModel and outSimilarity tables is determined by the itemBased parameter. If you set the itemBased parameter to True, then an item-based model is produced, and elements of the outModel and outSimilarity tables correspond to items. If you set the itemBased parameter to False, then a user-based model is produced, and elements of the outModel and outSimilarity tables correspond to users. The table that you specify in the outModel parameter contains the item ID or user ID and the item’s or user’s nearest neighbors. The table that you specify in the outSimilarity parameter contains the item ID or user ID and the similarity scores of the item’s or user’s nearest neighbor.
The table that you specify in the savestate parameter is a binary representation that contains the nearest neighbors, similarity scores, and training data. This binary model representation allows recommendations to be generated using the trained model with analytic store scoring. If you set the itemBased parameter to True during training by the recKnn action, then for a given user, candidate recommendations are generated by identifying the nearest neighbors of each item in the user’s set of historical item interactions from the training data. If you set the itemBased parameter to False during training by the recKnn action, then for a given user, similar users are identified and candidate recommendations are generated from the similar users’ historical information that the model contains. If the same candidate item is identified multiple times from the nearest-neighbor information, then the similarity score metrics are aggregated. When you use an analytic store for scoring, you specify the method of aggregation in the ASTORE procedure by specifying the AGGREGATION_METHOD name in a name-value pair. The available values are shown in Table 5. For additional information about analytic store scoring, see the PROC ASTORE documentation in SAS Viya: Machine Learning Procedures.
Table 5: Aggregation Methods of Generating Recommendations with Analytic Stores Produced Using the recKnn Action
Note: denotes the set of user u’s items for which item i is located in the k-nearest neighborhood.
denotes the set of users in the k-nearest neighborhood of user u. The values
and
denote the mean and standard deviation, respectively, of the response variable that you specify in the
target parameter for row i of the matrix R.
Note: An AGGREGATION_METHOD value of 1 is available only when the recKnn action that generated the analytic store does not include the target parameter. AGGREGATION_METHOD values of 2 and 3 are available only when the recKnn action that generated the analytic store includes the target parameter. If AGGREGATION_METHOD is set to 0 when the target parameter is omitted, the predicted score is not normalized by .
The set of candidate recommendations is sorted using the aggregated similarity scores, and items that have the largest aggregated similarity scores are returned as user recommendations. If a user does not have enough historical item interactions available to generate the requested number of recommendations, then the recommendation set is supplemented with popular item recommendations.
Information about the output data tables is displayed in the OutputCasTables table.