BasketGenerator Example 2: Increase BasketSize - Teradata Vantage

Teradata® Vantage Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.0
8.00
Published
May 2019
Language
English (United States)
Last Update
2019-11-22
dita:mapPath
blj1506016597986.ditamap
dita:ditavalPath
blj1506016597986.ditaval
dita:id
lmf1502735330121
Product Category
Teradata Vantage

The number of combinations is typically reduced for a higher basket size.

Input

SQL Call

SELECT * FROM BasketGenerator (
  ON grocery_transaction PARTITION BY tranid
  USING
  TargetColumns ('item')
  BasketSize (4)
  Accumulate ('tranid')
  OutputCombinations ('true')
) AS dt ORDER BY tranid;

Output

tranid item1 item2 item3 item4
999 butter eggs flour milk
999 butter eggs flour spinach
999 butter eggs milk spinach
999 butter flour milk spinach
999 eggs flour milk spinach
1000 eggs flour milk spinach