1.1 - 8.10 - BasketGenerator Example: Increase BasketSize - Teradata Vantage

Teradata Vantage™ - Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.1
8.10
Published
October 2019
Content Type
Programming Reference
Publication ID
B700-4003-079K
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;

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.