ysights.viz.profiles_viz
Profile Visualization Functions
This module provides visualization functions for analyzing agent profile similarity within social networks. It helps visualize how agent interests align with their network neighbors and how this varies with network position.
- Functions:
profile_similarity_distribution: Histogram of similarity values
profile_similarity_vs_degree: Scatter plot of similarity vs. node degree
binned_similarity_per_degree: Box plots of similarity by degree bins
Example
Visualizing profile similarity:
from ysights import YDataHandler
from ysights.algorithms import profile_topics_similarity
from ysights.viz import (
profile_similarity_distribution,
profile_similarity_vs_degree,
binned_similarity_per_degree
)
ydh = YDataHandler('path/to/database.db')
network = ydh.social_network()
# Calculate similarities
similarities = profile_topics_similarity(ydh, network)
# Distribution plot
fig = profile_similarity_distribution([similarities], ['All Users'])
fig.show()
# Similarity vs degree
fig = profile_similarity_vs_degree([similarities], [network], ['All Users'])
fig.show()
# Binned by degree
fig = binned_similarity_per_degree([similarities], [network], ['All Users'])
fig.show()
See also
ysights.algorithms.profiles.profile_topics_similarity(): Calculate similaritiesysights.viz.paradox_viz: Paradox visualizations
Functions
|
Plot the binned similarity values per degree for each population. |
Plot the binned distribution of similarity values of the populations passed as a list of dictionaries. |
|
|
Plot a scatter plot of similarity values vs. |
- ysights.viz.profiles_viz.profile_similarity_distribution(similarities, population_names)[source]
Plot the binned distribution of similarity values of the populations passed as a list of dictionaries.
- ysights.viz.profiles_viz.profile_similarity_vs_degree(similarities, gs, population_names)[source]
Plot a scatter plot of similarity values vs. node degree for each population.
- Parameters:
- Returns:
matplotlib figure object
- ysights.viz.profiles_viz.binned_similarity_per_degree(similarities, gs, population_names, bins=10)[source]
Plot the binned similarity values per degree for each population.
- Parameters:
similarities (
list[dict]) – list of dictionaries containing similarity values for each populationgs (
list) – list of graphs corresponding to each population in the similarities listpopulation_names (
list[str]) – list of names corresponding to each population in the similarities listbins – number of bins to use for the histogram
- Returns:
matplotlib figure object