graspologic icon indicating copy to clipboard operation
graspologic copied to clipboard

Update sbm_estimators.py

Open bokveizen opened this issue 1 month ago • 1 comments

Reference Issues/PRs

See Issue #1055 See Pull Request https://github.com/graspologic-org/graspologic/pull/1056#issuecomment-2105258389

What does this implement/fix? Briefly explain your changes.

Expected Behavior

Any size-1 block should just have zero probability.

Actual Behavior

In sbm_estimators.py, _calculate_block_p calls _calculate_p, which divides zero when block.size = 0. This can happen when some block has size one and loops=False is used.

Adding

if block.size == 0:
    continue

before Line 519 of graspologic/graspologic/models/sbm_estimators.py should do the trick.

bokveizen avatar May 11 '24 02:05 bokveizen