Modularity Example: Weighted Edges, Community Edge Table | Teradata Vantage - Modularity Example: Weighted Edges, Community Edge Table - 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 specifies CommunityEdgeTable, which Teradata recommends only when necessary, because creating this table can greatly increase function run time.

Followers follow leaders with different intensity.

SQL Call

SELECT * FROM Modularity (
  ON friends AS Vertices PARTITION BY friends_name
  ON followers_leaders AS Edges PARTITION BY follower
  USING
  TargetKey ('leader')
  CommunityAssociation ('group_id')
  EdgeWeight ('intensity')
  Accumulate ('friends_name','location')
) AS dt ORDER BY friends_name;

Output

 friends_name location      resolution community_id num_communities modularity_score    
 ------------ ------------- ---------- ------------ --------------- ------------------- 
 alex         san francisco        1.0 los angeles                2 0.44268423318862915
 bob          los angeles          1.0 los angeles                2 0.44268423318862915
 casey        los angeles          1.0 los angeles                2 0.44268423318862915
 danny        new york city        1.0 birmingham                 2 0.44268423318862915
 eve          birmingham           1.0 birmingham                 2 0.44268423318862915
 fox          austin               1.0 birmingham                 2 0.44268423318862915
 gohar        miami                1.0 los angeles                2 0.44268423318862915
 harry        chicago              1.0 los angeles                2 0.44268423318862915

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