Repository navigation
Integrate kernel mixtures, nested groups, and reconstruction statistics - #184
Merged
Merged
Conversation
…nels
Kernel('rbf' | 'laplace' | 'mexican_hat', n_components): factors, exact
first and second derivatives (any number of components, softmax mixing
logits), ResidualProblem/ProjectedProblem/bounds/Prior generalized. One RBF
component keeps the original code paths (scripts/rbf_fingerprint.py: 341
arrays bit for bit equal to main). Finite-difference tests per shape.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… generator HTFA.fit(groups=..., subject_ids=...) builds a template tree (global, groups level by level, subjects); fixed/empirical updates solve the tree jointly. htfa.groups: group_tree, GroupTree, GroupTest, group_permutation_test. HTFAResults: group_centers/group_widths, group_subjects, group= on node and network plots. make_group_data in htfa.synthetic. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ta scripts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ective nodes
TFA/HTFA take kernel ('rbf', 'laplace', 'mexican_hat') and n_components;
mixture factors report component centers/widths and mixing weights, with
mixing-weighted centers_/widths_. HTFA's template carries every component
and the mixing logits (priors and MAP update as for the widths); fits are
matched to the template by factor, then by component. 'mexican_hat' is the
D-dimensional negative Laplacian of a Gaussian (integral 0). The generators
draw from each shape; effective nodes use each profile. A plain RBF fit calls
the kernel functions exactly as before (test_fit_equivalence's oracle swap),
and rbf_fingerprint.py still matches main bit for bit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lse positives); changelog Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…play tests/reference_shapes.py builds every factor symbolically from the profile definitions and assembles the objectives densely (full Jacobian; Schur complement of the joint (theta, W) Hessian for varpro). 240 generated scenarios over kernel, components, coordinates, sizes, widths, centers, logits, weights, loss, prior and data agree to <= 4e-10 (amplified tolerance). Whole-fit tests: recovery per kernel and of well-separated mixtures, R^2 on generated mixtures, HTFA template recovery and bitwise n_jobs independence per shape and mode, effective nodes, results. sympy added to the dev extra. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Profiles in 1D and 2D; synthetic data from rbf, laplace, mexican_hat and a two-component RBF mixture; a generator x fitted-kernel grid of training and held-out variance explained at K = 5; sweeps over K and n_components; the fitted components. Executed with saved outputs (24 s locally). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
API reference (kernel, n_components, components, effective nodes), a validation section with the measured numbers (rbf fingerprint, finite differences, the sympy oracle sweep with error injection, recovery, HTFA, effective nodes, Linux, tutorial grid), changelog and README. htfa.tfa.component_factors takes the kernel by name; tutorial 12 uses only the public API and passes ruff. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TFA.factors evaluates single RBFs as before (also for fits saved without the component attributes); unused TFA._x removed; htfa.fit passes kernel and n_components to TFA and HTFA (test). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-clipped components, input checks Reordering M >= 3 components changes the logits' reference component; matched mixing weights are clipped back into the logit box so that template and starts stay feasible. Generated component centers are clipped to the grid (global ones too). effective_nodes rejects mixing_weights with 2D centers; TFA checks every field of a mixture prior. Tests for each; the measured fit numbers and tutorial outputs are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jeremymanning
marked this pull request as ready for review
October 28, 2026 22:38
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.
This integrates RBF, Laplace and Mexican-hat kernels and fitted component mixtures with nested subject groups. BrainNet and Nilearn plots preserve each component lobe and repeat its factor connection value. It adds conditional reconstruction R²/AIC/AICc/BIC and executed statistics and real-fMRI comparison tutorials, with explicit limits on interpreting these scores.
Refreshed tutorial fits and matching permutation nulls have immutable filenames and verified hashes. The decoding tutorial checks its exact inputs and describes its transductive preprocessing. Candidate workflows test installed wheels and execute all notebooks across Linux, macOS and Windows with Python 3.10–3.14; they do not publish.
Publication is blocked pending Jeremy's careful review and explicit approval. No PyPI or TestPyPI upload has occurred. The publication example is inactive, outside
.github/workflows.Validation: hardened installed-wheel suite 1003 passed (17 skipped, 28 deselected); BrainIAK cross-check 27 passed; fresh sdist smoke 15 passed; all 13 notebooks executed from an installed wheel locally; all 9 registered tutorial asset checks passed; lint, formatting, mypy and strict Sphinx build passed. Final-head cross-platform CI is pending. The initial matrix exposed a macOS screenshot rounding difference; the regression now verifies exact geometry and tightly bounded pixel differences.
Independent review and final cross-platform validation remain gates. Review packet:
notes/RELEASE_REVIEW.md; detailed provenance:notes/2026-10-28-release-review.mdandnotes/tutorial-assets-2026-10-28.json. The PCA-limit exploration remains local-only.