Repository navigation
Closed
Labels
epicEpic tracking issue
Description
Motivation
The module layout grew organically and is hard to navigate: NumPy code is split across
pyAMICA.py + amica_*.py prefixed modules, and the PyTorch code carries amica_torch.py,
amica_torch_ng.py, amica_torch_v2.py. We want clean, topic-based names (newton, pdf,
data, ...) shared conceptually between backends, with PyTorch counterparts where needed, and no
redundant amica_/_torch/_v2 prefixes. Clean code is a first-class goal, not cosmetic.
This is intentionally separate from the parity work (epic #9 / PR #33) so renames don't muddy
the parity diff.
Proposed target structure
pyAMICA/
├── amica.py # public scikit-learn-style interface (unchanged import path)
├── version.py
├── numpy_impl/ # (or keep flat) legacy NumPy reference
│ ├── core.py # was pyAMICA.py (AMICA_NumPy)
│ ├── newton.py # was amica_newton.py
│ ├── pdf.py # was amica_pdf.py
│ ├── data.py # was amica_data.py
│ ├── load.py # was amica_load.py
│ ├── viz.py # was amica_viz.py
│ ├── utils.py # was amica_utils.py
│ └── cli.py # was amica_cli.py
└── torch_impl/
├── core.py # was amica_torch_ng.py (AMICATorchNG, the parity backend)
├── newton.py # was newton_optimizer.py
├── pdf.py # was adaptive_pdf.py
├── mixture.py # was mixture_models.py
├── optim.py # was optimizers.py
├── output.py # was fortran_output.py
└── utils.py # unchanged
(Exact package split -- flat vs numpy_impl/ -- to be decided in phase 1.)
Constraints
- Keep the public import surface stable:
from pyAMICA import AMICA, AMICA_NumPy, AMICATorchNG. - No backward-compat shims / re-export stubs for old module paths (per project rules); update all
call sites, tests, CLI, and docs directly. - Real-data tests stay green throughout; parity unchanged.
Suggested phasing (sub-issues to be created when this starts)
- Decide package layout + rename the PyTorch
torch_impl/modules; update imports/tests/docs. - Rename the NumPy modules (
amica_*.py-> topic names); updatepyAMICA.py->core, CLI, tests. - Docs/ADR pass; update AGENTS.md architecture map and Key Files.
Depends on / coordinate with
- Remove parked AMICATorchV2 and promote backend='ng' to default #32 (remove parked
AMICATorchV2, retire the basicamica_torch.py, promotebackend="ng"):
do that first so we don't rename files that are about to be deleted. - Legacy CLI save/load format mismatch (.npy vs Fortran binary) #30 / GaussianMixtureICA.fit_em log-likelihood decreases across iterations #31 (legacy basic-backend bugs) inform whether
amica_torch.pysurvives the rename.
Not scheduled yet -- filed to capture intent; start after PR #33 (and ideally #32) land.
Metadata
Metadata
Assignees
Labels
epicEpic tracking issue
Activity
Clean module naming: numpy_impl/ + topic names (#34)
README: fix File Structure paths for #34 rename
Clean module naming: numpy_impl/ + topic names (#34) (#56)
docs: consolidate dev docs into .context
docs: consolidate dev docs into .context (#58)
Phase 6: end-to-end validation across backends (#332)