<jupyter_start><jupyter_text>Monopartite projection edge weight distribution<jupyter_code># Some path wizardry to make python acknowledge relative paths, just ignore this part...
import sys; sys.path.append('..')
import csv
import networkx as nx
import matplotlib.pyplot as plt
from pelote import (
    table_to_bipartite_graph,
    graph_to_edges_dataframe,
    monopartite_projection
)
with open('../data/bipartite2.csv') as f:
    bi = table_to_bipartite_graph(csv.DictReader(f), 'account', 'post')
for metric in [None, 'jaccard', 'dice', 'overlap', 'binary_cosine']:
    mono = monopartite_projection(bi, 'account', metric=metric)
    ax = graph_to_edges_dataframe(mono).weight.plot.hist(bins=25)
    ax.set_title(metric or 'raw')
    plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11681643132220795, 'fraction_numerical': 0.0038510911424903724, 'mean_word_length': 5.554621848739496, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '136439', 'license': 'MIT', 'n_tokens_mistral': 275, 'n_tokens_neox': 270, 'n_words': 63, 'path': 'notebooks/Monopartite Weight Distribution.ipynb', 'repo_name': 'medialab/pelote', 'size': '779'}