Skip to content

AMICA_NumPy silently ignores unknown options #346

Description

@neuromechanist

Symptom

AMICA_NumPy(**kwargs) accepts any keyword and silently ignores the ones it does not read. The constructor forwards **kwargs into a params dict that it reads with about 62 params.get(...) calls, so a typo (max_iters=50, lrates=0.1) or an option the NumPy backend does not implement (keep_best=True, n_restarts spelled for another backend) constructs without an error or a warning and has no effect. Found by epic #324 Phase 8 (#334, PR #342): AMICA_NumPy(keep_best=True) constructs and is ignored. The torch and MLX constructors take explicit keyword parameters and raise TypeError for unknown names, and the params-file reader (#304) already rejects unknown keys, so only the NumPy keyword path fails silently.

Fix

Validate the keyword arguments against the set of options the NumPy backend actually reads (a single module-level set shared with the params-file routing, _CONSUMED_KEYS/_CANONICAL_TO_NUMPY_KEY), and raise TypeError naming each unknown key, with a close-match suggestion when there is one. For options that other backends support but NumPy does not (for example keep_best, and pdftype other than 0, which already raises), raise a clear error that says so. Add a test for a typo, an unsupported option, and every documented option accepted. Changelog: a behavior change for the legacy backend (unknown options now raise).

Part of epic #324.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions