Skip to content

NeMoS 0.2.7 Release Notes

Choose a tag to compare

@BalzaniEdoardo BalzaniEdoardo released this 27 Feb 23:04
· 809 commits to main since this release
9e47020

NeMoS 0.2.7 Release Notes

New Features

Pytree Regularization Strength (by @wulfdewolf)

Enabled fine-grained regularization strength at group or individual-parameter level. regularizer_strength now accepts any pytree structure matching the model parameter tree:

# Group-wise: different strength per feature group
glm = nmo.glm.GLM(regularizer="Ridge", regularizer_strength=dict(f1=0.1, f2=0.5))

# Parameter-wise: per-coefficient strength
glm = nmo.glm.GLM(
    regularizer="Ridge",
    regularizer_strength=dict(f1=[0.1, 0.3, 0.3, 0.1, 1.0], f2=[0.2, 0.1])
)

Previously, a single scalar applied uniformly to all parameters. A new how-to guide
(docs/how_to_guide/finegrained_regularization.md) documents the full range of options,
including per-neuron regularization in population models.

Custom Solver API (by @bagibence)

Users can now register and use their own solvers via a formal protocol and registry:

  • SolverProtocol: runtime-checkable protocol defining the interface any custom solver must
    implement; NeMoS raises an informative error if a solver does not conform.
  • SolverSpec: specification object for pairing a solver class with an algorithm/backend pair
    in the registry.
  • Regularizer.allow_solver(): class method to declare which solvers a regularizer supports.
  • Enhanced registry public API: register(), set_default(), get_solver(),
    list_available_algorithms(), list_algo_backends().
  • Solver validation module (solvers/_validation.py) for runtime conformance checks.
  • How-to guide (docs/how_to_guide/custom_solvers.md) with end-to-end examples.

Scale Parameter Optimization in GLM-HMM EM (by @BalzaniEdoardo)

The EM algorithm now jointly optimizes the scale parameter of observation models that support it
(Gaussian, Gamma). Both analytical M-step updates and gradient-based updates are supported
depending on the observation model.

GLM-HMM Initialization Utilities (by @BalzaniEdoardo)

New public utilities for initializing GLM-HMM parameters, including Dirichlet prior sampling for
initial/transition probabilities and per-neuron tiled intercept initialization. These simplify
constructing valid starting states for the EM algorithm.

Bounds Handling for Basis Functions (by @BalzaniEdoardo, @wulfdewolf)

  • fill_value parameter on all eval-mode bases: controls the value substituted for
    out-of-bounds samples (default jnp.nan). The repr shows fill_value only when bounds
    is set.
  • Multi-dimensional bounds: bounds now accepts a list of (min, max) tuples, one per input
    dimension, for multi-input composite bases. None entries disable bounds for a given dimension.
  • FourierBasis explicitly disallows bounds (periodicity makes clipping semantics undefined).

Bug Fixes

  • Feature mask in cross-validation (#484): feature mask was incorrectly dropped when cloning a
    model during cross-validation.
  • Optax-based SGD learning rate (#488): sign error in the Optax gradient descent learning rate
    caused divergence.
  • Bounds: None-bounds NaN masking (#498): where-based NaN masking was applied
    unconditionally, injecting NaNs into unbounded bases.
  • Bounds: _is_single_bound detection (bounds-hotfix): None entries in a bounds sequence
    were misclassified, breaking partially-unbounded 1D bounds.
  • GLM-HMM M-step (#506): miscellaneous fix in GLM-HMM M-step.

Breaking Changes

  • FISTA solver state: iter_num renamed to num_steps in ProxGradState, consistent with
    Optimistix conventions. Code that accesses solver state fields directly will need updating.

Improvements

  • _n_input_dimensionality internal attribute renamed to _n_inputs across all basis classes.
  • Regularizer.check_solver no longer parses solver names via string matching; compatibility is
    now determined through the registry and allow_solver.
  • AtomicBasisMixin signature inconsistency between __init__ and set_input_shape fixed.
  • Lazy imports for solver and basis modules reduce import-time overhead.
  • simulation.py refactored to reduce code duplication.

What's Changed

New Contributors

Full Changelog: 0.2.6...0.2.7