ash_model.measures.hyperedge_profile_entropy¶
- ash_model.measures.hyperedge_profile_entropy(h, hyperedge_id, tid)[source]¶
Computes the entropy of the hyperedge profile, i.e., the entropy of the attribute values for each attribute in the hyperedge nodes’ profiles.
- Parameters:
- Returns:
A dictionary with attribute names as keys and their entropy as values
- Return type:
Examples
Using the same dataset as above, the entropy for the selected hyperedge at tid=0:
>>> import numpy as np, networkx as nx >>> from ash_model.utils.networkx import from_networkx_maximal_cliques_list >>> Gs = [nx.barabasi_albert_graph(100, 3, seed=i) for i in range(10)] >>> rng = np.random.default_rng(42) >>> for G in Gs: ... for n in G.nodes(): ... G.nodes[n]['color'] = 'red' if rng.integers(0, 2) == 0 else 'blue' >>> h = from_networkx_maximal_cliques_list(Gs) >>> tid = 0 >>> he0 = next(iter(h.hyperedges(start=tid, end=tid))) >>> hyperedge_profile_entropy(h, he0, tid) {'color': 0}