Skip to content

AMICA wrapper marks is_fitted_ even on a degenerate (nan_ll/singular_ll) fit #50

Description

@neuromechanist

Surfaced during PR #49 review (silent-failure-hunter).

pyAMICA/amica.py's AMICA.fit() sets self.is_fitted_ = True unconditionally after self.model_.fit(...), regardless of self.model_.stop_reason. If a fit ends degenerate (stop_reason in nan_ll/singular_ll), transform()/fit_transform() will still run and return NaN sources with no exception and no wrapper-level surfacing (only a backend logger.warning several frames down).

This is pre-existing (not introduced by #49) and broader than the multi-model c update, but the n_models>1 feature makes it more reachable in ordinary use.

Scope:

  • After fit(), if stop_reason indicates degeneracy, either raise or expose it clearly (and/or refuse transform() on a degenerate model), consistent with state_dict() which already refuses to serialize such a model.
  • Decide the contract: hard error vs. a converged_/stop_reason_ attribute the caller must check.

Note: PR #49 added a containment guard so the per-model bias c can no longer go NaN from a dead model, which reduces (but does not remove) the ways a multi-model fit can end degenerate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions