BasketGenerator Example: Increase BasketSize - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
8.10
1.1
Published
October 2019
Language
English (United States)
Last Update
2019-12-31
dita:mapPath
ima1540829771750.ditamap
dita:ditavalPath
jsj1481748799576.ditaval
dita:id
B700-4003
lifecycle
previous
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;

Output

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

Download a zip file of all examples and a SQL script file that creates their input tables from the attachment in the left sidebar.