Metrics and Analysis
The metrics module provides various analysis tools and measurement functions for hypernetworks.
Experimental Frameworks
hiper.metrics.experiments
experiments.py
Implements resilience experiments for hypergraphs including node removal simulations with random and TOPSIS-based selection strategies.
- class hiper.metrics.experiments.ResilienceExperiment(s=1)[source]
Bases:
objectConducts resilience experiments on hypergraphs by simulating various attack scenarios and measuring their impact on structural metrics.
This class provides comprehensive experimental capabilities for analyzing hypergraph resilience under different node removal strategies including random selection and TOPSIS-based targeted attacks.
- __init__(s=1)[source]
Initialize experiment framework.
- Parameters:
s (
int) – Parameter for s-walk computations.
- run_node_removal_experiment(hypernetwork, removal_percentages, random_trials=10)[source]
Run comprehensive node removal experiment.
- Parameters:
hypernetwork (
Hypernetwork) – Target hypergraph for analysis.removal_percentages (
List[float]) – List of percentages to remove (e.g., [1, 2, 5, 10, 25]).random_trials (
int) – Number of trials for random removal strategy.
- Return type:
- Returns:
Dictionary containing experimental results and analysis data.
hiper.metrics.comprehensive_resilience
comprehensive_resilience.py
Comprehensive resilience experiments for hypergraphs including both node and hyperedge removal simulations with random and TOPSIS-based selection strategies.
This module provides enhanced experimental capabilities including TOPSIS-based targeted attacks on both nodes and hyperedges, and evaluation using both traditional metrics and new higher-order cohesion measures.
- class hiper.metrics.comprehensive_resilience.ComprehensiveResilienceExperiment(s=1, m=2, node_ranker='topsis')[source]
Bases:
objectComprehensive resilience experiment framework supporting both node and hyperedge removal experiments with comprehensive metric evaluation.
This class provides enhanced experimental capabilities including TOPSIS-based targeted attacks on both nodes and hyperedges, and evaluation using both traditional metrics and new higher-order cohesion measures.
- run_node_and_hyperedge_removal_experiments(hypernetwork, removal_percentages, random_trials=10)[source]
Run comprehensive resilience analysis including both node and hyperedge removal.
- Parameters:
hypernetwork (
Hypernetwork) – Target hypergraph for analysis.removal_percentages (
List[float]) – List of percentages to remove (e.g., [1, 2, 5, 10, 25]).random_trials (
int) – Number of trials for random removal strategies.
- Return type:
- Returns:
Comprehensive results dictionary with all experiments and metrics.
Ranking and Selection
hiper.metrics.topsis
topsis.py
Implements TOPSIS (Technique for Order Preference by Similarity to Ideal Solution) method for ranking hypergraph nodes based on multiple criteria. Based on the approach described in the PIF-MN paper.
- class hiper.metrics.topsis.TopsisNodeRanker[source]
Bases:
objectRanks hypergraph nodes using TOPSIS multi-criteria decision method.
Criteria used (as per PIF-MN paper): 1. Number of hyperedges containing the node (hyperdegree) 2. Number of nodes in the neighborhood 3. Average clustering coefficient of the neighborhood 4. Degree centrality of the node 5. Binary indicator for participation in closed triads
- get_top_nodes(hypernetwork, percentage)[source]
Get top percentage of nodes by TOPSIS ranking.
- Parameters:
hypernetwork (
Hypernetwork) – Target hypergraph.percentage (
float) – Percentage of top nodes to return (0-100).
- Return type:
- Returns:
List of top node IDs.
hiper.metrics.hyperedge_topsis
hyperedge_topsis.py
TOPSIS-based ranking system for hyperedges using specialized criteria.
Evaluates hyperedges based on size, number of intersections with other hyperedges, and encapsulation relationships for targeted removal experiments.
- class hiper.metrics.hyperedge_topsis.HyperedgeTopsisRanker[source]
Bases:
objectTOPSIS-based ranking system for hyperedges using specialized criteria.
Evaluates hyperedges based on size, number of intersections with other hyperedges, and encapsulation relationships.
- rank_hyperedges(hypernetwork, weights=None)[source]
Rank hyperedges using TOPSIS method with specialized criteria.
- Parameters:
hypernetwork (
Hypernetwork) – Target hypergraph for analysis.weights (
Optional[Dict[str,float]]) – Optional weights for criteria. Default: equal weights. Expected keys: ‘size’, ‘intersections’, ‘encapsulation’
- Return type:
- Returns:
List of (hyperedge_id, topsis_score) tuples, sorted by score descending.
hiper.metrics.wsm
wsm.py
Implements WSM (Weighted Sum Model) method for ranking hypergraph nodes based on multiple criteria.
WSM is a simpler MCDM method that uses weighted normalization and summation to rank alternatives. It is expected to provide comparable but potentially less sophisticated results compared to TOPSIS.
- class hiper.metrics.wsm.WSMNodeRanker[source]
Bases:
objectRanks hypergraph nodes using WSM (Weighted Sum Model) multi-criteria decision method.
Criteria used (same as TOPSIS for comparability): 1. Number of hyperedges containing the node (hyperdegree) 2. Number of nodes in the neighborhood 3. Average clustering coefficient of the neighborhood 4. Degree centrality of the node 5. Binary indicator for participation in closed triads
- get_top_nodes(hypernetwork, percentage)[source]
Get top percentage of nodes by WSM ranking.
- Parameters:
hypernetwork (
Hypernetwork) – Target hypergraph.percentage (
float) – Percentage of top nodes to return (0-100).
- Return type:
- Returns:
List of top node IDs.
hiper.metrics.moora
moora.py
Implements MOORA (Multi-Objective Optimization on basis of Ratio Analysis) method for ranking hypergraph nodes based on multiple criteria.
MOORA is a simple MCDM method that uses vector normalization and weighted summation. It is simpler than TOPSIS and expected to provide comparable but potentially less sophisticated results.
- class hiper.metrics.moora.MOORANodeRanker[source]
Bases:
objectRanks hypergraph nodes using MOORA (Multi-Objective Optimization on basis of Ratio Analysis) multi-criteria decision method.
Criteria used (same as TOPSIS for comparability): 1. Number of hyperedges containing the node (hyperdegree) 2. Number of nodes in the neighborhood 3. Average clustering coefficient of the neighborhood 4. Degree centrality of the node 5. Binary indicator for participation in closed triads
- get_top_nodes(hypernetwork, percentage)[source]
Get top percentage of nodes by MOORA ranking.
- Parameters:
hypernetwork (
Hypernetwork) – Target hypergraph.percentage (
float) – Percentage of top nodes to return (0-100).
- Return type:
- Returns:
List of top node IDs.
Structural Metrics
hiper.metrics.connectivity
connectivity.py
Implements hypergraph and hyperedge connectivity metrics.
- class hiper.metrics.connectivity.HypergraphConnectivity(s=1)[source]
Bases:
objectComputes hypergraph connectivity κ(H).
The connectivity κ(H) is the minimum number of nodes that must be removed to disconnect the hypergraph or reduce it to a single isolated node.
- __init__(s=1)[source]
Initialize with s-walk parameter.
- Parameters:
s (
int) – Parameter for s-walk connectivity computation.
- compute(hypernetwork)[source]
Compute hypergraph connectivity.
- Parameters:
hypernetwork (
Hypernetwork) – Target hypergraph.- Return type:
- Returns:
Connectivity value κ(H).
- class hiper.metrics.connectivity.HyperedgeConnectivity(s=1)[source]
Bases:
objectComputes hyperedge connectivity λ(H).
The hyperedge connectivity λ(H) is the minimum number of hyperedges that must be removed to disconnect the hypergraph.
- __init__(s=1)[source]
Initialize with s-walk parameter.
- Parameters:
s (
int) – Parameter for s-walk connectivity computation.
- compute(hypernetwork)[source]
Compute hyperedge connectivity.
- Parameters:
hypernetwork (
Hypernetwork) – Target hypergraph.- Return type:
- Returns:
Hyperedge connectivity value λ(H).
hiper.metrics.distance
distance.py
Implements hypergraph distance computations and path finding algorithms. Provides s-walk and hyperpath functionality.
- class hiper.metrics.distance.HypergraphDistance(s=1)[source]
Bases:
objectComputes distances and paths in hypergraphs using s-walk semantics.
An s-walk is a sequence of alternating nodes and hyperedges where each hyperedge intersects at least s previously visited nodes in the walk.
- __init__(s=1)[source]
Initialize with parameter s for s-walk computation.
- Parameters:
s (
int) – Minimum intersection requirement for s-walks.
- find_shortest_s_walk(hypernetwork, source, target)[source]
Find shortest s-walk between two nodes using BFS.
- compute_distance(hypernetwork, source, target)[source]
Compute s-walk distance between two nodes.
- Parameters:
hypernetwork (
Hypernetwork) – Target hypergraph.source (
int) – Source node ID.target (
int) – Target node ID.
- Return type:
- Returns:
Length of shortest s-walk, or infinity if no path exists.
- is_connected(hypernetwork)[source]
Check if hypergraph is connected using s-walk semantics.
- Parameters:
hypernetwork (
Hypernetwork) – Target hypergraph.- Return type:
- Returns:
True if all node pairs are connected by s-walks.
hiper.metrics.redundancy
redundancy.py
Implements the redundancy coefficient ρ(H) for hypergraphs.
- class hiper.metrics.redundancy.RedundancyCoefficient[source]
Bases:
objectComputes the redundancy coefficient ρ(H).
The redundancy coefficient measures the average degree of normalized overlap between pairs of hyperedges in the hypergraph.
Formula: \(\rho(H) = \frac{2}{|E|(|E|-1)} \sum_{\substack{e_1, e_2 \in E \\ e_1 \neq e_2 \\ e_1 < e_2}} \frac{|e_1 \cap e_2|}{\sqrt{|e_1| \cdot |e_2|}}\)
The sum is over all unordered pairs of distinct hyperedges.
- static compute(hypernetwork)[source]
Compute the redundancy coefficient.
- Parameters:
hypernetwork (
Hypernetwork) – Target hypergraph.- Return type:
- Returns:
Redundancy coefficient value ρ(H) in range [0, 1].
- static compute_pairwise_overlaps(hypernetwork)[source]
Compute detailed pairwise overlap information.
- Parameters:
hypernetwork (
Hypernetwork) – Target hypergraph.- Return type:
- Returns:
List of tuples (edge1_id, edge2_id, intersection_size, normalized_overlap).
- get_most_overlapping_pairs(hypernetwork, top_k=5)[source]
Get the k most overlapping hyperedge pairs.
- Parameters:
hypernetwork (
Hypernetwork) – Target hypergraph.top_k (
int) – Number of top pairs to return.
- Return type:
- Returns:
List of top k overlapping pairs sorted by normalized overlap.
hiper.metrics.swalk
swalk.py
Implements s-walk efficiency metrics for hypergraphs.
- class hiper.metrics.swalk.SwalkEfficiency(s=1)[source]
Bases:
objectComputes average s-walk efficiency ℰs(H).
The s-walk efficiency measures how efficiently nodes can reach each other via s-walks, computed as the average of inverse distances.
Formula: \(\mathcal{E}_s(H) = \frac{1}{|V|(|V|-1)} \sum \frac{1}{d_H^s(u,v)}\) for all pairs \(u,v \in V\) with \(u \neq v\).
- __init__(s=1)[source]
Initialize with s-walk parameter.
- Parameters:
s (
int) – Parameter for s-walk computation.
- compute(hypernetwork)[source]
Compute average s-walk efficiency.
- Parameters:
hypernetwork (
Hypernetwork) – Target hypergraph.- Return type:
- Returns:
S-walk efficiency value ℰs(H) in range [0, 1].
- compute_detailed(hypernetwork)[source]
Compute detailed s-walk efficiency statistics.
- Parameters:
hypernetwork (
Hypernetwork) – Target hypergraph.- Return type:
- Returns:
Dictionary with efficiency statistics including average, min, max.
- compute_node_efficiencies(hypernetwork)[source]
Compute individual node efficiency scores.
- Parameters:
hypernetwork (
Hypernetwork) – Target hypergraph.- Return type:
- Returns:
Dictionary mapping node IDs to their efficiency scores.
- find_critical_nodes(hypernetwork, top_k=5)[source]
Find nodes whose removal would most impact s-walk efficiency.
- Parameters:
hypernetwork (
Hypernetwork) – Target hypergraph.top_k (
int) – Number of critical nodes to return.
- Return type:
- Returns:
List of (node_id, efficiency_impact) tuples.
Higher-Order Metrics
hiper.metrics.higher_order_cohesion
higher_order_cohesion.py
Implements Higher-Order Cohesion Resilience (HOCR) and Largest Higher-Order Component (LHC) metrics for analyzing hypergraph resilience based on m-th order components.
The m-th higher-order component is defined as a set of hyperedges where each hyperedge shares at least m nodes with another hyperedge in the same component.
- class hiper.metrics.higher_order_cohesion.HigherOrderCohesionMetrics(m=2)[source]
Bases:
objectComputes Higher-Order Cohesion Resilience (HOCR) and Largest Higher-Order Component (LHC) metrics for hypergraph resilience analysis.
These metrics evaluate how perturbations affect the higher-order structure of hypergraphs by analyzing components where hyperedges share at least m nodes.
- __init__(m=2)[source]
Initialize the higher-order cohesion metrics calculator.
- Parameters:
m (
int) – Minimum number of shared nodes required between hyperedges in the same m-th order component. Must be >= 2.- Raises:
ValueError – If m < 2.
- compute_mth_order_components(hypernetwork)[source]
Compute the m-th higher-order components of the hypernetwork.
An m-th higher-order component is a set of hyperedges where each hyperedge shares at least m nodes with another hyperedge in the same component.
- Parameters:
hypernetwork (
Hypernetwork) – The input hypergraph.- Return type:
- Returns:
List of components, where each component is a list of hyperedge indices.
- compute_hocr_m(original_hypernetwork, perturbed_hypernetwork)[source]
Compute Higher-Order Cohesion Resilience (HOCR_m).
HOCR_m measures the normalized preservation of higher-order structure after perturbation by comparing the total number of hyperedges in m-th order components before and after perturbation.
- Parameters:
original_hypernetwork (
Hypernetwork) – The original hypergraph.perturbed_hypernetwork (
Hypernetwork) – The hypergraph after perturbation.
- Return type:
- Returns:
HOCR_m value in [0, 1], where 1 indicates perfect preservation.
- compute_lhc_m(original_hypernetwork, perturbed_hypernetwork)[source]
Compute Largest Higher-Order Component (LHC_m) resilience.
LHC_m measures how well the largest m-th order component is preserved after perturbation.
- Parameters:
original_hypernetwork (
Hypernetwork) – The original hypergraph.perturbed_hypernetwork (
Hypernetwork) – The hypergraph after perturbation.
- Return type:
- Returns:
LHC_m value in [0, 1], where 1 indicates perfect preservation.
- compute_all_metrics(original_hypernetwork, perturbed_hypernetwork)[source]
Compute both HOCR_m and LHC_m metrics.
- Parameters:
original_hypernetwork (
Hypernetwork) – The original hypergraph.perturbed_hypernetwork (
Hypernetwork) – The hypergraph after perturbation.
- Return type:
- Returns:
Dictionary containing both metrics.
hiper.metrics.hyperedge_fragmentation
hyperedge_fragmentation.py
This module implements the Hyperedge Fragmentation Index (HFI) metric for measuring how much hyperedges have been fragmented by perturbations.
- class hiper.metrics.hyperedge_fragmentation.HyperedgeFragmentationIndex[source]
Bases:
objectComputes the Hyperedge Fragmentation Index (HFI) metric.
The Hyperedge Fragmentation Index measures how much the original hyperedges have been fragmented by a perturbation:
\(\text{HFI} = 1 - \frac{1}{|E|} \sum_{e \in E} \frac{|e \cap V'|}{|e|}\)
where: - E is the original set of hyperedges - V’ is the set of nodes after perturbation - \(e \cap V'\) is the intersection of original hyperedge e with remaining nodes - \(|e|\) is the original size of hyperedge e
A value of 0.0 indicates no fragmentation (all hyperedges intact), while 1.0 indicates complete fragmentation (all hyperedges destroyed).
- static compute(perturbed_hypergraph, original_hypergraph)[source]
Compute the Hyperedge Fragmentation Index metric.
- Parameters:
perturbed_hypergraph (
Hypernetwork) – The hypergraph after perturbation.original_hypergraph (
Hypernetwork) – The original hypergraph before perturbation.
- Return type:
- Returns:
The hyperedge fragmentation index value in [0, 1].
- Raises:
ValueError – If original_hypergraph has no hyperedges.
- static compute_detailed(perturbed_hypergraph, original_hypergraph)[source]
Compute detailed fragmentation statistics.
- Parameters:
perturbed_hypergraph (
Hypernetwork) – The hypergraph after perturbation.original_hypergraph (
Hypernetwork) – The original hypergraph before perturbation.
- Return type:
- Returns:
Dictionary containing detailed fragmentation analysis.
- static get_hyperedge_fragmentation_map(perturbed_hypergraph, original_hypergraph)[source]
Get fragmentation status for each individual hyperedge.
- Parameters:
perturbed_hypergraph (
Hypernetwork) – The hypergraph after perturbation.original_hypergraph (
Hypernetwork) – The original hypergraph before perturbation.
- Return type:
- Returns:
Dictionary mapping hyperedge IDs to their fragmentation status.
hiper.metrics.hyperedge_integrity
hyperedge_integrity.py
This module implements the Hyperedge Integrity (HI) metric for measuring the resilience of hypergraphs by calculating the ratio of hyperedges preserved after perturbation.
- class hiper.metrics.hyperedge_integrity.HyperedgeIntegrity[source]
Bases:
objectComputes the Hyperedge Integrity (HI) metric.
The Hyperedge Integrity measures the fraction of hyperedges that remain in the hypergraph after a perturbation:
\(\text{HI} = \frac{|E'|}{|E|}\)
where E is the original set of hyperedges and E’ is the set of hyperedges after perturbation.
A value of 1.0 indicates perfect integrity (no hyperedges lost), while 0.0 indicates complete loss of all hyperedges.
- static compute(perturbed_hypergraph, original_hypergraph=None)[source]
Compute the Hyperedge Integrity metric.
- Parameters:
perturbed_hypergraph (
Hypernetwork) – The hypergraph after perturbation.original_hypergraph (
Optional[Hypernetwork]) – The original hypergraph before perturbation. If None, assumes the metric is computed on the current state only.
- Return type:
- Returns:
The hyperedge integrity value in [0, 1].
- Raises:
ValueError – If original_hypergraph is None when required.
ZeroDivisionError – If the original hypergraph has no hyperedges.
- compute_change(before_hypergraph, after_hypergraph)[source]
Compute the change in hyperedge integrity.
- Parameters:
before_hypergraph (
Hypernetwork) – Hypergraph state before perturbation.after_hypergraph (
Hypernetwork) – Hypergraph state after perturbation.
- Return type:
- Returns:
The change in integrity (negative values indicate loss).
Additional Metrics
hiper.metrics.average_hyperedge_cardinality
average_hyperedge_cardinality.py
This module implements the Average Hyperedge Cardinality (AHC) metric for measuring the average size of hyperedges in a hypergraph after perturbation.
- class hiper.metrics.average_hyperedge_cardinality.AverageHyperedgeCardinality[source]
Bases:
objectComputes the Average Hyperedge Cardinality (AHC) metric.
The Average Hyperedge Cardinality measures the mean size of hyperedges in the hypergraph after perturbation:
\(\text{AHC} = \frac{1}{|E'|} \sum_{e \in E'} |e|\)
where E’ is the set of hyperedges after perturbation and \(|e|\) is the cardinality (size) of hyperedge e.
This metric provides insight into how perturbations affect the size distribution of hyperedges, which can impact the hypergraph’s functional properties.
- static compute(hypergraph)[source]
Compute the Average Hyperedge Cardinality metric.
- Parameters:
hypergraph (
Hypernetwork) – The hypergraph to analyze.- Return type:
- Returns:
The average hyperedge cardinality.
- Raises:
ValueError – If the hypergraph has no hyperedges.
- compute_change(before_hypergraph, after_hypergraph)[source]
Compute the change in average hyperedge cardinality.
- Parameters:
before_hypergraph (
Hypernetwork) – Hypergraph state before perturbation.after_hypergraph (
Hypernetwork) – Hypergraph state after perturbation.
- Return type:
- Returns:
The change in average cardinality (can be positive or negative).
- static get_cardinality_distribution(hypergraph)[source]
Get the distribution of hyperedge cardinalities.
- Parameters:
hypergraph (
Hypernetwork) – The hypergraph to analyze.- Return type:
- Returns:
Dictionary mapping cardinality values to their frequencies.
- static get_statistics(hypergraph)[source]
Get comprehensive cardinality statistics.
- Parameters:
hypergraph (
Hypernetwork) – The hypergraph to analyze.- Return type:
- Returns:
Dictionary containing mean, median, std, min, max cardinalities.
hiper.metrics.centrality_disruption
centrality_disruption.py
This module implements the Centrality Disruption Index (CDI) metric for measuring how perturbations affect the centrality distribution of nodes in a hypergraph.
- class hiper.metrics.centrality_disruption.CentralityDisruptionIndex(centrality_type='degree')[source]
Bases:
objectComputes the Centrality Disruption Index (CDI) metric.
The Centrality Disruption Index measures how much a perturbation affects the centrality distribution of nodes using the Kolmogorov-Smirnov test:
\(\text{CDI} = \text{KS}(\{C^{\text{pre}}_v\}, \{C^{\text{post}}_v\})\)
where: - \(C^{\text{pre}}_v\) are centrality values before perturbation - \(C^{\text{post}}_v\) are centrality values after perturbation - KS is the Kolmogorov-Smirnov distance between distributions
The metric returns a value in [0, 1] where: - 0.0 indicates no disruption (identical distributions) - 1.0 indicates maximum disruption (completely different distributions)
- __init__(centrality_type='degree')[source]
Initialize the Centrality Disruption Index metric.
- Parameters:
centrality_type (
str) – Type of centrality to use (‘degree’, ‘closeness’, ‘betweenness’, or custom function).
- compute(before_hypergraph, after_hypergraph, centrality_function=None)[source]
Compute the Centrality Disruption Index metric.
- Parameters:
before_hypergraph (
Hypernetwork) – The hypergraph before perturbation.after_hypergraph (
Hypernetwork) – The hypergraph after perturbation.centrality_function (
Optional[Callable]) – Custom centrality function. If None, uses built-in centrality based on centrality_type.
- Return type:
- Returns:
The centrality disruption index value in [0, 1].
- compute_detailed(before_hypergraph, after_hypergraph, centrality_function=None)[source]
Compute detailed centrality disruption analysis.
- Parameters:
before_hypergraph (
Hypernetwork) – The hypergraph before perturbation.after_hypergraph (
Hypernetwork) – The hypergraph after perturbation.centrality_function (
Optional[Callable]) – Custom centrality function.
- Return type:
- Returns:
Dictionary containing detailed analysis results.
hiper.metrics.entropy_loss
entropy_loss.py
This module implements the Entropy Loss (EL) metric for measuring how perturbations affect the entropy of various distributions in a hypergraph.
- class hiper.metrics.entropy_loss.EntropyLoss(distribution_type='node_degree', log_base=2.0)[source]
Bases:
objectComputes the Entropy Loss (EL) metric.
The Entropy Loss measures how much entropy is lost in a distribution after a perturbation:
\(\text{EL} = H(P^{\text{pre}}) - H(P^{\text{post}})\)
where: - \(H(P) = -\sum p_i \log(p_i)\) is the Shannon entropy - \(P^{\text{pre}}\) is the distribution before perturbation - \(P^{\text{post}}\) is the distribution after perturbation
Positive values indicate entropy loss (reduced diversity), negative values indicate entropy gain (increased diversity), and zero indicates no change in entropy.
The metric can be applied to various distributions such as: - Node degree distribution - Hyperedge size distribution - Hyperedge degree distribution
- __init__(distribution_type='node_degree', log_base=2.0)[source]
Initialize the Entropy Loss metric.
- compute(before_hypergraph, after_hypergraph)[source]
Compute the Entropy Loss metric.
- Parameters:
before_hypergraph (
Hypernetwork) – The hypergraph before perturbation.after_hypergraph (
Hypernetwork) – The hypergraph after perturbation.
- Return type:
- Returns:
The entropy loss value (positive = loss, negative = gain).
- compute_detailed(before_hypergraph, after_hypergraph)[source]
Compute detailed entropy analysis.
- Parameters:
before_hypergraph (
Hypernetwork) – The hypergraph before perturbation.after_hypergraph (
Hypernetwork) – The hypergraph after perturbation.
- Return type:
- Returns:
Dictionary containing detailed entropy analysis.
- compute_multiple_distributions(before_hypergraph, after_hypergraph)[source]
Compute entropy loss for multiple distribution types.
- Parameters:
before_hypergraph (
Hypernetwork) – The hypergraph before perturbation.after_hypergraph (
Hypernetwork) – The hypergraph after perturbation.
- Return type:
- Returns:
Dictionary containing entropy loss for each distribution type.
- compute_relative_entropy_loss(before_hypergraph, after_hypergraph)[source]
Compute relative entropy loss (normalized by initial entropy).
- Parameters:
before_hypergraph (
Hypernetwork) – The hypergraph before perturbation.after_hypergraph (
Hypernetwork) – The hypergraph after perturbation.
- Return type:
- Returns:
Relative entropy loss in [0, 1] or negative for entropy gain.