PSALSA Example 2: User Similarity in Social Network with Edge Weight - 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™

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