Add Phase of Matter quantum dataset generator#1044
Open
rogue-infinity wants to merge 5 commits into
Open
Conversation
Implements phase_of_matter_data() as a new dataset in qiskit_machine_learning/datasets/phase_of_matter/: - Four spin-chain Hamiltonians built via SparsePauliOp (no extra deps): heisenberg (trivial/topological), haldane (afm/paramagnetic/spt), annni (ferromagnetic/paramagnetic/floating/antiphase), cluster (haldane/ferromagnetic/antiferromagnetic/trivial) - Exact ground states via scipy.sparse.linalg.eigsh (default) - Optional VQE pathway for hardware-experiment workflows - Follows existing dataset API: training_size, test_size, one_hot, formatting, class_labels, include_sample_total, seed, backend - 55-test suite covering Hermiticity, normalization, eigenstate residuals, phase label coverage, shape contracts, reproducibility Reference: Bermejo-Vega et al., arXiv:2408.12739 (2024)
- Add STFC copyright header to all 8 new files - Rename variable H -> ham throughout (C0103 invalid-name) - Add docstrings to all test methods (C0116 missing-function-docstring) - Move 'from test import' before third-party imports (C0411 wrong-import-order) - Add :type backend: object to fix W9016 missing-type-doc in two functions - Replace British spellings with American: normalised, optimisation, mislabelled - Replace Greek chars in inline comments with ASCII equivalents - Add Callable type annotation to _fixed_hamiltonian to fix mypy operator error - Add domain-specific words to .pylintdict for spell check
- Add rng, geq, ddt, idata, atol, eigh, zxz, simulatable to .pylintdict - Fix neighbour/favour -> neighbor/favor in _haldane.py - Fix parameterised/honoured -> parameterized/honored in test file - Reword 'RNG' -> 'random number generator' in phase_of_matter.py docstring - Fix Simulable -> Simulatable in paper reference - Fix W9016: use 'backend (object):' Google-style in both _base.py and phase_of_matter.py; remove incorrect ':type backend:' RST lines - Add '# doctest: +SKIP' to docstring examples (consistent with existing datasets which have no running doctests) - Replace 'atol' param name with 'tol' in _is_hermitian helper - Replace 'ZXZ' in comment with 'Z-X-Z' - Reword 'namespace' and 'eigh' references in test docstrings
The sphinx LowercaseFilter downcases checked words before dict lookup, so dictionary entries must be lowercase. Bermejo and Simulatable were capitalised, causing sphinx-build -M spelling to fail despite pylint spell check passing.
Contributor
Author
|
@OkuyanBoga @adekusar-drl @oscar-wallis Awaiting your response on this! |
Coverage Report for CI Build 25775720082Coverage increased (+0.1%) to 89.802%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
Contributor
Author
|
@OkuyanBoga, all the tests passed successfully, could you please go through the PR and let me know any modifications/ suggestions/ additions need to be made? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
phase_of_matter_data()toqiskit_machine_learning/datasets/as a new sub-packagephase_of_matter/"heisenberg"- Bond-alternating XXX Heisenberg: phases trivial / topological"haldane"- Haldane chain: phases antiferromagnetic / paramagnetic / spt"annni"- Axial Next-Nearest-Neighbor Ising: phases ferromagnetic / paramagnetic / floating / antiphase"cluster"- Cluster Hamiltonian (periodic BC): phases haldane / ferromagnetic / antiferromagnetic / trivialscipy.sparse.linalg.eigsh(exact diagonalization, default). Optional VQE pathway available viabackend=argument for hardware-experiment workflowstraining_size,test_size,one_hot,formatting,class_labels,include_sample_total,seed,backend)Files changed
qiskit_machine_learning/datasets/phase_of_matter/__init__.pyqiskit_machine_learning/datasets/phase_of_matter/phase_of_matter.pyphase_of_matter_data()APIqiskit_machine_learning/datasets/phase_of_matter/_base.pypauli_term, exact diag, VQEqiskit_machine_learning/datasets/phase_of_matter/_heisenberg.pyqiskit_machine_learning/datasets/phase_of_matter/_haldane.pyqiskit_machine_learning/datasets/phase_of_matter/_annni.pyqiskit_machine_learning/datasets/phase_of_matter/_cluster.pyqiskit_machine_learning/datasets/__init__.pyphase_of_matter_datatest/datasets/test_phase_of_matter.pyTest plan
pytest test/datasets/test_phase_of_matter.py, 55 tests covering Hermiticity of all Hamiltonians, ground-state normalization, eigenstate residuals, phase label coverage for all models, API shape contracts, seed reproducibility, and error handlingUsage example