Fix KeyError in example_auto_select_uq.py for Pareto mode compatibility#1131
Merged
SkBlaz merged 3 commits intomasterSkBlaz/py3plex:masterfrom Jan 17, 2026
copilot/add-uq-stability-analysis-exampleSkBlaz/py3plex:copilot/add-uq-stability-analysis-exampleCopy head branch name to clipboard
Merged
Fix KeyError in example_auto_select_uq.py for Pareto mode compatibility#1131SkBlaz merged 3 commits intomasterSkBlaz/py3plex:masterfrom copilot/add-uq-stability-analysis-exampleSkBlaz/py3plex:copilot/add-uq-stability-analysis-exampleCopy head branch name to clipboard
SkBlaz merged 3 commits intomasterSkBlaz/py3plex:masterfrom
copilot/add-uq-stability-analysis-exampleSkBlaz/py3plex:copilot/add-uq-stability-analysis-exampleCopy head branch name to clipboard
Conversation
Co-authored-by: SkBlaz <10035780+SkBlaz@users.noreply.github.com>
Co-authored-by: SkBlaz <10035780+SkBlaz@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add auto-select example with uncertainty quantification
Fix KeyError in example_auto_select_uq.py for Pareto mode compatibility
Jan 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The UQ example code assumed wins mode leaderboard structure (
rank,algorithmcolumns), but the default Pareto mode usesevaluation_matrixwith different column names (algorithm_id). This caused KeyErrors when accessing leaderboard columns and missing provenance keys.Changes
examples/communities/example_auto_select_uq.pymetrics_by_bucketaccess conditional (wins mode only)py3plex/algorithms/community_detection/auto_select.pyuq_n_samplesanduq_methodto Pareto mode'sselection_configfor consistency with wins modeExample
Original prompt
This section details on the original issue you should resolve
<issue_title>another community example</issue_title>
<issue_description>uv run example_auto_select_uq.py
Auto-Select with Uncertainty Quantification (UQ)
UQ provides stability analysis for community detection,
helping identify algorithms that produce robust results.
Note: UQ examples take longer as they run multiple iterations.
======================================================================
Example 1: Auto-select with UQ (seed-based)
Network: 15 nodes, 22 edges
Running auto-select with UQ (10 samples)...
This will take longer as algorithms are run multiple times...
2026-01-17 11:23:40 - py3plex.core.multinet - INFO - --------------------
2026-01-17 11:23:40 - py3plex.core.multinet - INFO - Network splitting in progress
2026-01-17 11:23:40 - py3plex.core.multinet - INFO - --------------------
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 100/100 [00:00<00:00, 2534.87it/s]
BarnesHut Approximation took 0.01 seconds
Repulsion forces took 0.02 seconds
Gravitational forces took 0.00 seconds
Attraction forces took 0.00 seconds
AdjustSpeedAndApplyForces step took 0.00 seconds
2026-01-17 11:23:40 - py3plex.core.converters - INFO - Finished with layout..
/home/blazs/py3plex/py3plex/algorithms/community_detection/autocommunity_executor.py:60: UserWarning: Algorithm 'leiden' failed: multilayer_leiden_uq() got an unexpected keyword argument 'seed'
algorithm_results = _run_candidate_algorithms(
======================================================================
AutoCommunity v2 Selection Report (Pareto Mode)
Winner: louvain:default
Communities detected: 4
Coverage: 1.000
--- Why This Algorithm Won ---
✓ Dominated all other algorithms (sole Pareto-optimal solution)
• modularity: 0.524
• coverage: 1.000
• stability: 1.000
--- Trade-offs ---
(No other algorithms to compare)
--- Stability & Uncertainty ---
Partition stability: 1.000
→ High confidence in community assignments
Mean node confidence: 1.000
--- Null-Model Calibration ---
(Null-model calibration not enabled)
--- Graph Regime Interpretation ---
Degree heterogeneity: 0.263
Inter-layer coupling: 0.000
→ Weakly coupled layers
--- Reproducibility ---
Random seed: 42
Pareto selection: True
UQ enabled: True
======================================================================
--- Leaderboard with Stability Metrics ---
algorithm_id modularity coverage stability
louvain:default 0.52376 1.0 1.0
--- Stability Analysis ---
Higher stability values indicate more consistent partitions
across different random seeds/perturbations.
======================================================================
Example 2: Stability comparison across algorithms
Network: 25 node-layer pairs
Running auto-select with UQ to compare stability...
Using seed-based method for robustness testing...
2026-01-17 11:23:40 - py3plex.core.multinet - INFO - --------------------
2026-01-17 11:23:40 - py3plex.core.multinet - INFO - Network splitting in progress
2026-01-17 11:23:40 - py3plex.core.multinet - INFO - --------------------
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 100/100 [00:00<00:00, 2517.97it/s]
BarnesHut Approximation took 0.01 seconds
Repulsion forces took 0.02 seconds
Gravitational forces took 0.00 seconds
Attraction forces took 0.00 seconds
AdjustSpeedAndApplyForces step took 0.00 seconds
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 100/100 [00:00<00:00, 4193.88it/s]
BarnesHut Approximation took 0.01 seconds
Repulsion forces took 0.01 seconds
Gravitational forces took 0.00 seconds
Attraction forces took 0.00 seconds
AdjustSpeedAndApplyForces step took 0.00 seconds
2026-01-17 11:23:40 - py3plex.core.converters - INFO - Finished with layout..
/home/blazs/py3plex/py3plex/algorithms/community_detection/autocommunity_executor.py:57: UserWarning: Failed to compute some regime features: tuple index out of range
regime_features = _compute_graph_regime(network)
/home/blazs/py3plex/py3plex/algorithms/community_detection/autocommunity_executor.py:60: UserWarning: Algorithm 'leiden' failed: multilayer_leiden_uq() got an unexpected keyword argument 'seed'
algorithm_results = _run_candidate_algorithms(
=============================================...
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.