nPath Example | Teradata Vantage - nPath Example: Checkout Paths for Purchases Over $200 - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
9.02
9.01
2.0
1.3
Published
February 2022
Language
English (United States)
Last Update
2022-02-10
dita:mapPath
rnn1580259159235.ditamap
dita:ditavalPath
ybt1582220416951.ditaval
dita:id
B700-4003
lifecycle
previous
Product Category
Teradata Vantageā„¢

This example finds the paths to the checkout page for purchases over $200.

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.8571428571429
         5 [home, home, home, home, home1, home1, home1, page1, page1, page1, page2, page2, page2, checkout, checkout, checkout, page2, page2, page2] 363.1578947368421

Download a zip file of all examples and a SQL script file that creates their input tables.