Tuesday, March 20, 2012

Association model prediction not using itemsets

I have a market basket model using associations. It generated several dozen itemsets. However when I attempt to run a singleton prediction like this:

select (Predict(Orderproduct3q,INCLUDE_STATISTICS,10)) as [Recommendation]

From

[Case All]

NATURAL PREDICTION JOIN

(SELECT (SELECT '16407' AS [Pname])) AS t1

the resulting predictions don't take the itemsets into account. Instead, the predictions consist of the ranked products in the training set, ordered by frequency. This appears to happen regardless of the precise query specified within the "natural prediction join".

What's going on here and how do I generate a singleton prediction which makes use of the itemsets?

The nested table inside the input should have the same name as the nested table of the model, for Natural prediction Join. Could you please try this:

select (Predict(Orderproduct3q,INCLUDE_STATISTICS,10)) as [Recommendation]

From

[Case All]

NATURAL PREDICTION JOIN

(SELECT (SELECT '16407' AS [Pname]) AS Orderproduct3q ) AS t1

Otherwise, the input rowset (t1) contains an unnamed nested table which cannot be mapped to your model's table

|||

Thanks for the suggestion, which was on the right lines. Something like this does now pick up one of the itemsets.

select (Predict(Orderproduct3q,INCLUDE_STATISTICS,10)) as [Recommendation]

From

[Case All]

NATURAL PREDICTION JOIN
(SELECT (SELECT '17717' AS Pname Union SELECT '16415' AS Pname) as Orderproduct3q ) AS t1

|||Also look at the tip/trick at http://www.sqlserverdatamining.com/DMCommunity/TipsNTricks/3514.aspxsql

No comments:

Post a Comment