Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix for SBM estimator with some size-one block and loops=False #1056

Closed
wants to merge 2 commits into from

Conversation

bokveizen
Copy link

Reference Issues/PRs

See Issue #1055

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.

bdpedigo and others added 2 commits September 29, 2023 11:38
* Added Python 3.11 (graspologic-org#1039)

* add python 3.11

* fix numba dep warning

* add release note entry (graspologic-org#1040)

* Updated heatmap (graspologic-org#750)

* test pytest ini

* add binary_heatmap, updates to tutorial notebook

* test plotting

* re-add pytest.ini

* Update plot.py

Fix a few bugs

* add new tests

* Update setup.cfg

* remove binary_heatmap

* mpl version req back to normal

* remove binary_heatmap import

* black

* formatting fix

---------

Co-authored-by: Benjamin Pedigo <benjamindpedigo@gmail.com>

* Fixed bugs in type specifications from Numpy 1.25 release (graspologic-org#1047)

* attempted fix for matrix type erroring

* fix spec of csr_array

* add a random seed

* remove isspmatrix

* fix a type check

* black

* Added option for more efficient graph matching matrix operations (graspologic-org#1046)

* more efficient graph matching matrix operations

* fix formatting

* remove an unused import (unrelated)

* expose fast kwarg to user, docs

* run black formatter

* add typehint

* fix mypy

---------

Co-authored-by: bkj <ben@jataware.com>
Co-authored-by: bdpedigo <benjamindpedigo@gmail.com>

* Added an `ax` argument for `screeplot`

* Add ax argument to screeplot (now returns None)

* add a return value for screeplot()

* Refactored for best practices

* Fixed Matplotlib 3.8 compatibility issues (graspologic-org#1049)

* specify angle as kwarg

* try removing some maybe unnecessary code?

* fight with mypy

* black

* fix sorts

* try switch to explain

* fix intersphinx

* other instances of wrong tutorial intersphinx

* 3.3.0 release prep (graspologic-org#1050)

* add release notes

* bump version

---------

Co-authored-by: Alex Loftus <alexloftus2004@gmail.com>
Co-authored-by: Ben Johnson <bkj.322@gmail.com>
Co-authored-by: bkj <ben@jataware.com>
Co-authored-by: Prajwal Agrawal <61898798+kidkoder432@users.noreply.github.com>
bug fix for size-one blocks with loops=False
@bdpedigo
Copy link
Collaborator

thanks for this @bokveizen - right now some tests are failing due to unrelated reasons, once I have a fix for that I'll have a look at this. but at a glance, it seems perfect

@bdpedigo
Copy link
Collaborator

if you are still interested, you could merge dev into this branch, and i believe tests will pass now

@bokveizen bokveizen changed the base branch from main to dev May 11, 2024 02:52
@bokveizen bokveizen closed this May 11, 2024
@bokveizen bokveizen reopened this May 11, 2024
@bokveizen bokveizen closed this May 11, 2024
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.

None yet

2 participants