This example shows how to limit the vertices and edges used. Teradata recommends this technique if the original vertices and edges tables are large, but only a subset of the information is relevant. The function calculates the hubs and authorities for the nodes specified in the sources and targets tables (user_source_nodes and product_target_nodes).
Input
As in PSALSA Example 3: User Similarity and Product Recommendation:
- vertices: user_product_nodes, which has customer names
- edges: women_apparel_log, which reflects customer shopping patterns
SQL Call
SELECT * FROM PSALSA ( ON user_product_nodes AS vertices PARTITION BY nodename ON women_apparel_log AS edges PARTITION BY username ON user_source_nodes AS sources PARTITION BY username ON product_target_nodes AS targets PARTITION BY product USING SourceKey ('username') TargetKey ('product') EdgeWeight ('frequency') MaxHubNum (2) MaxAuthorityNum (2) TeleportProb (0.15) RandomWalkLength (500) ) AS dt ORDER BY username, hub_score DESC, authority_score DESC;
Output
Based on the output, the retailer recommends pajamas to Sandra, who has no purchase history for them, but recommends nothing to Susan, who has bought all the items (see the PSALSA Example 3: User Similarity and Product Recommendation input). The *_score results vary with every run.
username | hub_username | hub_score | authority_product | authority_score |
---|---|---|---|---|
Sandra | pajamas | 0.333333333333333 | ||
Sandra | Sally | 0.214007782101167 | ||
Sandra | Susan | 0.140077821011673 | ||
Susan | Stacie | 0.206766917293233 | ||
Susan | Sally | 0.176691729323308 |