ysights.viz.paradox_viz
Paradox Visualization Functions
This module provides visualization functions for the visibility paradox analysis. It includes density scatter plots, histograms, and population size effect visualizations to help understand asymmetries in content visibility within social networks.
- Functions:
paradox_density_scatter: 2D density scatter plot comparing user and neighbor visibility
paradox_histogram: Distribution of paradox scores across users
paradox_size_impact: Line plots showing how paradox varies with population fraction
Example
Visualizing the visibility paradox:
from ysights import YDataHandler
from ysights.algorithms import visibility_paradox, user_visibility_vs_neighbors
from ysights.viz import paradox_density_scatter, paradox_histogram
ydh = YDataHandler('path/to/database.db')
network = ydh.social_network()
# Get visibility data
user_vis, neighbor_vis = user_visibility_vs_neighbors(ydh, network)
# Density scatter plot
fig = paradox_density_scatter(
user_vis, neighbor_vis,
xlabel='User Impressions',
ylabel='Avg Neighbor Impressions',
title='Visibility Paradox'
)
fig.show()
# Calculate full paradox with statistics
paradox_results = visibility_paradox(ydh, network, N=100)
# Histogram of paradox scores
fig = paradox_histogram(paradox_results, bins=50)
fig.show()
See also
ysights.algorithms.paradox.visibility_paradox(): Calculate paradox metricsysights.algorithms.paradox.user_visibility_vs_neighbors(): Get visibility data
Functions
|
|
|
Plot a histogram of the visibility paradox data. |
|
Analyze the impact of network size on the visibility paradox. |
- ysights.viz.paradox_viz.paradox_density_scatter(x, y, xlabel='Impressions', ylabel='Avg. Neighbors Impressions', title='')[source]
- Parameters:
x
y
xlabel
ylabel
title
- Returns:
Example usage: >>> from ysights import algorithms, viz, YDataHandler >>> handler = YDataHandler(“path_to_your_database.db”) >>> network = handler.social_network() >>> x, y = algorithms.user_visibility_vs_neighbors(handler, network) >>> viz.paradox_density_scatter(x, y, xlabel=’Impressions’, ylabel=’Avg. Neighbors Impressions’, title=”Visibility Paradox”)
- ysights.viz.paradox_viz.paradox_histogram(x, bins=30, title='Friendship Paradox')[source]
Plot a histogram of the visibility paradox data.
- Parameters:
x
bins
title
- Returns:
Example usage: >>> from ysights import algorithms, viz, YDataHandler >>> handler = YDataHandler(“path_to_your_database.db”) >>> network = handler.social_network() >>> results = algorithms.visibility_paradox(handler, network, N=0) >>> viz.paradox_histogram(results[‘nodes_coefficients’], bins=10, title=”Visibility Paradox Histogram”)
- ysights.viz.paradox_viz.paradox_size_impact(data)[source]
Analyze the impact of network size on the visibility paradox.
- Parameters:
YDH – YDataHandler, the data handler containing the YSocial simulation data
g – networkx.Graph, the social network graph
N – int, number of null models to generate for statistical testing
- Returns:
dict with size impact results