Predicting based on rules alone and getting everything you always wanted

In this post I explained how to couch an associative prediction that omitted predictions that were based solely on marginal statistics.  The one catch was that if you asked for 5 items, you might not get 5, you could get 4 or 3 or even down to 0, since all predictions without a corresponding prediction node id were filtered out.

However, by leveraging the TopCount function, you can have your bread and butter it too (it's late).  Use syntax like the following:

SELECT TopCount(
                  (SELECT Product, $Probability FROM
                          PredictAssociation(Products, INCLUDE_STATISTICS, INCLUDE_NODE_ID)
                          WHERE $NodeID <> ''),
                  $PredictProbability,
                  5) AS PredictedProducts
FROM MyAssociationModel
NATURAL PREDICTION JOIN
.....

Comments