【创新应用】新增 QReupload:数据重上传变分量子学习模块(可训练 input scaling + Fourier/贫瘠高原诊断)#24
Open
freak-jaeuk wants to merge 2 commits into
Open
【创新应用】新增 QReupload:数据重上传变分量子学习模块(可训练 input scaling + Fourier/贫瘠高原诊断)#24freak-jaeuk wants to merge 2 commits into
freak-jaeuk wants to merge 2 commits into
Conversation
Add pyqpanda_alg/QReupload — the package's first supervised estimator whose circuit parameters are trained against a task loss (sklearn-style fit), using exact adjoint gradients (vqcircuit.VQCircuit + ADJOINT_DIFF). - QReuploadRegressor / QReuploadClassifier: data re-uploading models with a trainable input-scaling factor and an optional CNOT entangling ring. - fourier_spectrum: recover the learned Fourier harmonics of a 1-feature model. - trainability_scan: barren-plateau diagnostic (Var[d<Z>/dtheta] vs qubit count). - example/QAlgBase/testeg_qreupload.py: spectrum readout, entanglement ablation on a non-separable cross-frequency target, and a barren-plateau scan, each shown next to a classical Fourier-ridge baseline (no over-claiming). - test/QAlgBase/Test_QReupload.py: 10 unit tests (behaviour + estimator contract). Registers the subpackage in pyqpanda_alg/__init__.py, matching the existing QSVM/QSVD/... convention.
- README.md: add a Chinese (中文) section alongside the English reference. - Tutorials/source/QReupload.rst: narrative walkthrough (quick start, learned Fourier-spectrum readout, when entanglement matters, barren-plateau scan). - Tutorials/source/index.rst: register the tutorial and the QReupload API reference in the toctree.
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.
What
Adds
pyqpanda_alg/QReupload/, the package's first supervised estimator whosecircuit parameters are trained against a task loss (sklearn-style
fit).QSVM/QSVRfit only a classical SVM over a parameter-free quantum featuremap;
QSVD/QAOAare variational but not supervised ML estimators.QReuploadRegressor/QReuploadClassifier— data re-uploading models witha trainable input-scaling factor and an optional CNOT entangling ring,
trained with exact adjoint gradients (
vqcircuit.VQCircuit+ADJOINT_DIFF).fourier_spectrum(model)— recovers which Fourier harmonics a fitted1-feature model learned (the model realises a truncated Fourier series; Schuld,
Sweke & Meyer, PRA 103, 032430, 2021).
trainability_scan(qubit_range)— barren-plateau diagnostic,Var[∂⟨Z⟩/∂θ]vs qubit count.Why
Gives
pyqpanda-algorithma trainable QML model (not just kernels), plus twotools that make encoding expressivity and trainability inspectable before
scaling a circuit.
Validation
test/QAlgBase/Test_QReupload.py— 10 unit tests pass: behaviour (fit,band-limited spectrum, entanglement necessity on a non-separable cross-frequency
target, classifier, barren-plateau decay, parameter count, multi-feature smoke)
and estimator-contract checks (rejects wrong feature count / length-mismatched /
non-finite input,
get_params/set_paramsround-trip).example/QAlgBase/testeg_qreupload.py— three demos: (A) 1-featureregression + learned Fourier-spectrum readout; (B) an entangle-vs-no-entangle
ablation on
y = 2sin(x0) + 1.5cos(x1) + sin(x0+x1)(the cross term makesentanglement load-bearing); (C) a barren-plateau scan. Each is shown next to
a classical Fourier-ridge baseline — no over-claiming: the classical full-Fourier
model appears only as an oracle handed the exact basis a priori.
Notes (verified on pyqpanda3 0.3.5)
Param(λ)·float(x)); a product of twoplaceholders (
Param·Param) yields a zero adjoint gradient on pyqpanda3 0.3.5.numpy+pyqpanda3; the example importssklearnforthe classical comparator (same as the existing
QSVR/QKmeansexamples).fourier_spectrumis documented as an empirical DFT: the strict integer-degreebound holds for unit input scaling, since a trained scaling factor can move peaks
off the integer grid.
The new subpackage is registered in
pyqpanda_alg/__init__.pyalongside theexisting
QSVM/QSVD/… modules; the test follows this repo'stest/pytest.ini(
Test_*.pyundertest/QAlgBase/) andTest(feature, content)case naming.