ysights.viz.recommendations

Recommendation System Visualization Functions

This module provides visualization functions for analyzing recommendation system behavior in YSocial simulations. It helps visualize recommendation distributions, correlations with engagement metrics, and system balance.

Functions:
  • recommendations_per_post_distribution: Distribution of recommendation counts

  • recommendations_vs_reactions: Correlation between recommendations and reactions

  • recommendations_vs_comments: Correlation between recommendations and comments

Example

Visualizing recommendation patterns:

from ysights import YDataHandler
from ysights.viz import (
    recommendations_per_post_distribution,
    recommendations_vs_reactions,
    recommendations_vs_comments
)

ydh = YDataHandler('path/to/database.db')

# Distribution of recommendations
fig = recommendations_per_post_distribution(ydh)
fig.show()

# Recommendations vs reactions
fig = recommendations_vs_reactions(ydh)
fig.show()

# Recommendations vs comments
fig = recommendations_vs_comments(ydh)
fig.show()

See also

Functions

recommendations_per_post_distribution(YDH)

Plot the distribution of recommendations per post.

recommendations_vs_comments(YDH[, density])

Plot the relationship between recommendations and comments.

recommendations_vs_reactions(YDH[, density])

Plot the relationship between recommendations and reactions.

ysights.viz.recommendations.recommendations_per_post_distribution(YDH)[source]

Plot the distribution of recommendations per post.

Parameters:

YDH (YDataHandler) – YDataHandler instance for database operations

Returns:

a matplotlib figure showing the distribution of recommendations per post

ysights.viz.recommendations.recommendations_vs_reactions(YDH, density=False)[source]

Plot the relationship between recommendations and reactions.

Parameters:
  • YDH (YDataHandler) – YDataHandler instance for database operations

  • density – if True, use hexbin plot for density visualization

Returns:

a matplotlib figure showing the relationship between recommendations and reactions

ysights.viz.recommendations.recommendations_vs_comments(YDH, density=False)[source]

Plot the relationship between recommendations and comments.

Parameters:
  • YDH (YDataHandler) – YDataHandler instance for database operations

  • density – if True, use hexbin plot for density visualization

Returns:

a matplotlib figure showing the relationship between recommendations and comments