nPath Example 3: Find Paths to Checkout Page for Purchases Over $200 - Teradata Vantage

Machine Learning Engine Analytic Function Reference

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

Input

SQL Call

SELECT * FROM nPath@coprocessor (
  ON aggregate_clicks PARTITION BY sessionid ORDER BY clicktime
  USING
  Mode (nonoverlapping)
  Pattern ('A*.C+.A*')
  Symbols (productprice > 200 AND
          pagetype='checkout' AS C, true AS A)
  Result (FIRST(sessionid OF A) AS sessionid,
  Accumulate (pagetype OF ANY(A,C)) AS path,
    AVG (productprice OF ANY(A,C)) AS sum)
) AS dt;

Output

sessionid path sum
1 [home, home1, page1, home, home1, page1, home, home, home, home1, page1, checkout, home, home, home, home, home, home, home, home, home] 602.857142857143
5 [home, home, home, home, home1, home1, home1, page1, page1, page1, page2, page2, page2, checkout, checkout, checkout, page2, page2, page2] 363.157894736842