Skip to content

Add DirectionReconstructionWithLogKappa - #929

Merged
sevmag merged 2 commits into
graphnet-team:mainfrom
sevmag:feature/vmf-logkappa-head
Nov 7, 2026
Merged

sevmag merged 2 commits into
graphnet-team:mainfrom
sevmag:feature/vmf-logkappa-head

Conversation

@sevmag

@sevmag sevmag commented Oct 4, 2026

Copy link
Copy Markdown
Collaborator

Closes #928.

Adds DirectionReconstructionWithLogKappa: direction from the normalised first three outputs, kappa = kappa_min + exp(x[:, 3]) (kappa_min default 1). Same prediction layout as DirectionReconstructionWithKappa, so it works with VonMisesFisher3DLoss unchanged. The docstring of DirectionReconstructionWithKappa now notes its kappa ceiling and points to the new task.

Tests added in tests/models/test_task.py.

🤖 Generated with Claude Code

@christianlocatelli
christianlocatelli self-requested a review October 12, 2026 08:24

@christianlocatelli christianlocatelli left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @sevmag. Everything looks good and reasonable overall. I discussed the test functions with Aske though, and we think most of them aren't really necessary and are unlikely to catch future bugs.
test_log_kappa_direction_output, test_log_kappa_no_ceiling_and_no_overflow, and test_log_kappa_floor_must_be_positive mostly restate the _forward function and are clear from the code, would it be possible to remove them?
test_log_kappa_loss_and_gradients could arguably still be kept, because it checks the new head together with VonMisesFisher3DLoss, and a change in either of them could break the other. Let us know what you think about it.

Severin Magel and others added 2 commits November 5, 2026 16:28
Predicts kappa as kappa_min + exp(x[:, 3]) instead of the output norm,
removing the kappa ceiling of DirectionReconstructionWithKappa.

Refs graphnet-team#928

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@sevmag
sevmag force-pushed the feature/vmf-logkappa-head branch from 4ea0c9e to 544d07f Compare November 5, 2026 21:39
@sevmag

sevmag commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

@christianlocatelli, thanks for taking a look at it! I agree with you guys and reduced the tests.

@christianlocatelli christianlocatelli left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sevmag go for it!

@sevmag
sevmag merged commit df5dfcc into graphnet-team:main Nov 7, 2026
12 checks passed
@sevmag
sevmag deleted the feature/vmf-logkappa-head branch November 9, 2026 09:16
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.

Direction task: predict log κ as a separate output instead of κ = ‖x‖

2 participants