google / qhbm-library

Quantum Hamiltonian-Based Models built on TensorFlow Quantum
https://qhbm-library.readthedocs.io/en/latest/
Apache License 2.0
40 stars 15 forks source link

reorganize into subpackages #99

Closed sahilpatelsp closed 2 years ago

sahilpatelsp commented 2 years ago

It might be worth considering reorganizing the library into collective subpackages rather than modules consisting of single files, which is the current approach. One such organization scheme could be the following:

qhbmlib/
  __init__.py

  ebm/
        __init__.py
        ebm.py
        energy_functions/
            kobe.py
            mlp.py
            ...
        energy_samplers/
            energy_sampler.py
            mcmc/
                mcmc.py
                energy_kernel.py
                mh.py
                gwg.py
                ...

    qnn/
        __init__.py
        qnn.py
        pqc/
            hea.py
            qcnn.py
            ...

    qhbm/
        __init__.py
        qhbm.py

    losses/
        __init__.py
        vqt.py
        qmhl.py
        ...

    metrics/
        __init__.py
        fidelity.py
        ...

    datasets/
        __init__.py
        hamiltonian.py
        ...

    utils/
        __init__.py
        utils.py
zaqqwerty commented 2 years ago

Can you say more about why we should reorganize in this way? You say "It might be worth considering" - why might it be worth considering?

sahilpatelsp commented 2 years ago

This approach would allow us to divide a single module into multiple different files rather than having a one-to-one correspondence between modules and files, which might lead to files becoming quite involved as we add new classes. It essentially decouples the user-interface of modules from the underlying file structure.

farice commented 2 years ago

I like the idea of e.g. from qhbmlib import losses importing the qmhl and vqt files

zaqqwerty commented 2 years ago

@geoffreyroeder had a comment along these lines today: since we now lean heavily on the distinction between models and inference engines, it could make sense to make model and infer be subpackages.

zaqqwerty commented 2 years ago

Resolved by #196