PSALSA Example: Similar Users, Edge Weight | Teradata Vantage - PSALSA Example: Similar Users, Edge Weight - 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 uses the syntax elements MaxHubNum and MaxAuthorityNum to output a maximum of two hub and two authority users.

Input

As in PSALSA Example: Similar Users, No Edge Weight:
  • Vertices: users_vertex
  • Edges: users_edges

SQL Call

SELECT * FROM PSALSA (
  ON users_vertex AS Vertices PARTITION BY username
  ON users_edges AS Edges PARTITION BY followers
  USING
  SourceKey ('followers ')
  TargetKey ('leaders ')
  EdgeWeight ('likes')
  MaxHubNum (2)
  MaxAuthorityNum (2)
  TeleportProb (0.15)
  RandomWalkLength (1000)
) AS dt ORDER BY 1, 3 DESC, 5 DESC;

Output

The output shows that John and Winston are similar to Carla. John is more similar, as he has a higher hub_score. The output varies with every run.

 followers hub_followers hub_score           authority_leaders authority_score     
 --------- ------------- ------------------- ----------------- ------------------- 
 carla     john          0.29504950495049503 NULL                             NULL
 carla     winston       0.16237623762376238 NULL                             NULL
 carla     NULL                         NULL carla              0.1067193675889328
 carla     NULL                         NULL simon             0.03557312252964427
 celine    carla           0.300990099009901 NULL                             NULL
 celine    john          0.27524752475247527 NULL                             NULL
 celine    NULL                         NULL celine            0.17786561264822134
 celine    NULL                         NULL carla             0.10869565217391304
 john      carla                       0.278 NULL                             NULL
 john      winston                     0.138 NULL                             NULL
 simon     carla                        0.32 NULL                             NULL
 simon     john                         0.27 NULL                             NULL
 simon     NULL                         NULL celine                           0.18
 simon     NULL                         NULL carla                           0.102
 winston   carla                       0.324 NULL                             NULL
 winston   john                        0.264 NULL                             NULL
 winston   NULL                         NULL celine                          0.178
 winston   NULL                         NULL carla                           0.104

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