1.0 - 8.00 - BasketGenerator Example 2: Increase BasketSize - Teradata Vantage

Teradata® Vantage Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.0
8.00
Release Date
May 2019
Content Type
Programming Reference
Publication ID
B700-4003-098K
Language
English (United States)

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