1.0 - 8.00 - PSALSA Example 2: User Similarity in Social Network with Edge Weight - Teradata Vantage

Teradata® Vantage Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.0
8.00
Release Date
May 2019
Content Type
Programming Reference
Publication ID
B700-4003-098K
Language
English (United States)

This example uses the arguments MaxHubNum and MaxAuthorityNum to output a maximum of two hub and two authority users.

Input

As in PSALSA Example 1: User Similarity in Social Network without 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     Carla 0.158
Carla     Simon 0.022
Carla John 0.342    
Carla Winston 0.124    
Celine     Celine 0.168
Celine     Carla 0.12
Celine John 0.306    
Celine Carla 0.262    
John Carla 0.229083665338645    
John Winston 0.127490039840637    
Simon     Celine 0.186
Simon     Carla 0.14
Simon John 0.308    
Simon Carla 0.278    
Winston     Celine 0.169660678642715
Winston     Carla 0.147704590818363
Winston John 0.33    
Winston Carla 0.256