Repository navigation
Accept integer theta in dcsbm(), chung_lu() and directed_dcsbm() - #63
Draft
alexpghayes wants to merge 1 commit into
Draft
alexpghayes wants to merge 1 commit into
alexpghayes wants to merge 1 commit into
Conversation
set_membership_weights() wrote integer theta straight into the double `x` slot of the membership matrix, so integer theta (e.g. from `rpois(n, 2) + 1L`) crashed model construction, or with `sort_nodes = FALSE` built an invalid model that failed in expected_degree() and sample_sparse(). Coerce to double first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Bug
Integer
thetacrashed model construction:set_membership_weights()(R/utils.R) wrotethetastraight into the doublexslot of the membership matrix. It only worked withforce_identifiability = TRUEbecause normalizing made theta double. Inputs likerpois(n, 2) + 1Lhit this.Fix
Coerce to double inside
set_membership_weights(), as the shared-blocks branch ofdirected_dcsbm()already did at the call site.Tests
New
tests/testthat/test-integer-theta.R: integer theta fordcsbm(),chung_lu()anddirected_dcsbm()(k = 1 and 2), with bothforce_identifiabilityandsort_nodesvalues, gives the same model as the double version and can be sampled. Fails onmain(3 errors), passes here. Full suite passes.NEWS
Left out to avoid conflicting with the 1.0.0 reorganization in #59. Suggested bullet under Bug fixes:
🤖 Generated with Claude Code