Skip to content

Add max_resample option in Hill Estimator to avoid infinite loop - #36

Merged
mu373 merged 2 commits into
mainfrom
fix/hill-infinite-loop
Mar 27, 2026
Merged

Add max_resample option in Hill Estimator to avoid infinite loop#36
mu373 merged 2 commits into
mainfrom
fix/hill-infinite-loop

Conversation

@mu373

@mu373 mu373 commented Mar 26, 2026

Copy link
Copy Markdown
Owner

Overview

  • Fixed a bug where Hill Estimator gets infinite loop during resampling. Infinite (?) loop when fitting HillEstimator #35
  • It was caused by if k2 > k1 condition in hill_dbs(). For n<200, int(0.005*n) always floors to 0, which does not increment min_index1 and min_index2. This results in k1 and k2 to be stuck causing the infinite loop.
if k2 > k1:
    print("Warning (Hill): k2 > k1, AMSE false minimum suspected, resampling...")
    # move left AMSE boundary to avoid numerical issues
    min_index1 = min_index1 + int(0.005*n)
    min_index2 = min_index2 + int(0.005*n)
    k2 = None

Changes

  • Added max_resample option in Hill Estimator. If resampling count exceeds this, it raises RuntimeError.
HillEstimator(bootstrap=True, max_resample=3)
  • Added tests for max_resample with provided degree sequence.

@mu373 mu373 changed the title Fix infinite loop in Hill Estimator resampling Add max_resample option in Hill Estimator to avoid infinite loop Mar 27, 2026
@mu373
mu373 marked this pull request as ready for review March 27, 2026 15:16
@mu373
mu373 merged commit 90858de into main Mar 27, 2026
1 check passed
@mu373 mu373 mentioned this pull request Mar 27, 2026
@mu373
mu373 deleted the fix/hill-infinite-loop branch March 27, 2026 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant