softopt 0.6.2__tar.gz → 0.6.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {softopt-0.6.2/softopt.egg-info → softopt-0.6.3}/PKG-INFO +13 -1
- {softopt-0.6.2 → softopt-0.6.3}/README.md +12 -0
- {softopt-0.6.2 → softopt-0.6.3}/pyproject.toml +1 -1
- {softopt-0.6.2 → softopt-0.6.3}/softopt/__init__.py +1 -1
- {softopt-0.6.2 → softopt-0.6.3/softopt.egg-info}/PKG-INFO +13 -1
- {softopt-0.6.2 → softopt-0.6.3}/LICENSE +0 -0
- {softopt-0.6.2 → softopt-0.6.3}/setup.cfg +0 -0
- {softopt-0.6.2 → softopt-0.6.3}/softopt/compile.py +0 -0
- {softopt-0.6.2 → softopt-0.6.3}/softopt/numpy_optimizer.py +0 -0
- {softopt-0.6.2 → softopt-0.6.3}/softopt/soft_number.py +0 -0
- {softopt-0.6.2 → softopt-0.6.3}/softopt/torch_optimizer.py +0 -0
- {softopt-0.6.2 → softopt-0.6.3}/softopt.egg-info/SOURCES.txt +0 -0
- {softopt-0.6.2 → softopt-0.6.3}/softopt.egg-info/dependency_links.txt +0 -0
- {softopt-0.6.2 → softopt-0.6.3}/softopt.egg-info/requires.txt +0 -0
- {softopt-0.6.2 → softopt-0.6.3}/softopt.egg-info/top_level.txt +0 -0
- {softopt-0.6.2 → softopt-0.6.3}/tests/test_basic.py +0 -0
- {softopt-0.6.2 → softopt-0.6.3}/tests/test_causal.py +0 -0
- {softopt-0.6.2 → softopt-0.6.3}/tests/test_compile.py +0 -0
- {softopt-0.6.2 → softopt-0.6.3}/tests/test_measured_slope.py +0 -0
- {softopt-0.6.2 → softopt-0.6.3}/tests/test_soft_number.py +0 -0
- {softopt-0.6.2 → softopt-0.6.3}/tests/test_torch.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: softopt
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.3
|
|
4
4
|
Summary: A standalone optimizer for problems with a known computation graph, built on Klein–Maimon soft-number calculus
|
|
5
5
|
Author: Ido Angel
|
|
6
6
|
License: MIT
|
|
@@ -120,6 +120,8 @@ Your model needs to be built from arithmetic and the elementary functions the so
|
|
|
120
120
|
|
|
121
121
|
The one thing to avoid is converting a traced value back to a plain number mid-model — `float(x)`, or `np.array(params)` on the parameter list, both silently discard the derivative. `soft_compile`'s verification catches this and says so.
|
|
122
122
|
|
|
123
|
+
**Parameter scale.** SoftOpt's correction moves each parameter by at most 0.5 per step, a natural size for angles and other parameters of order 1. If your parameters live on a very different scale (pixel offsets of 0.03, prices in the thousands), rescale them to roughly ±1, or set the bound to match: `SoftOpt(n, g_delta, lr=..., newton_lo=-b, newton_hi=b)`.
|
|
124
|
+
|
|
123
125
|
If you'd rather write the derivative function yourself — because your model lives in a simulator SoftOpt can't trace, or because you want the speed of a hand-tuned implementation — pass any `g_delta(theta, delta)` that returns the exact directional derivative, and skip `soft_compile` entirely.
|
|
124
126
|
|
|
125
127
|
## Where the slope comes from: `slope="model"` or `slope="measured"`
|
|
@@ -204,6 +206,16 @@ All results below use IBM's `FakeFez` noise model via Qiskit + Aer, or realistic
|
|
|
204
206
|
|
|
205
207
|
Both run SoftOpt with its default settings on IBM's `FakeFez` noise model: `benchmarks/vqe/h4_real_molecule.py`, `benchmarks/vqe/h2_vs_cobyla.py`.
|
|
206
208
|
|
|
209
|
+
**Quantum machine learning**
|
|
210
|
+
|
|
211
|
+
| Test | Baseline | Result | Win rate |
|
|
212
|
+
|---|---|---|---|
|
|
213
|
+
| Variational quantum classifier (Iris, 4 qubits, 24 parameters), same budget of 300 readings, 20 seeds | Adam | 25% lower training loss; test accuracy on the device 70.0% vs 66.3% | 20/20 (loss), 15/20 + 3 ties (accuracy) |
|
|
214
|
+
| Variational quantum classifier (breast cancer, 8 qubits, 48 parameters), same budget, 10 seeds | Adam | 6% lower training loss; test accuracy on the device 90.0% vs 88.3% | 10/10 (loss), 7/10 + 2 ties (accuracy) |
|
|
215
|
+
| Same two classifiers | COBYLA | lower training loss (Iris 16/20, cancer 10/10); test accuracy tied | 16/20, 10/10 (loss) |
|
|
216
|
+
|
|
217
|
+
`benchmarks/qml/vqc.py --dataset iris|cancer`
|
|
218
|
+
|
|
207
219
|
**Quantum control**
|
|
208
220
|
|
|
209
221
|
| Domain | Improvement | Win rate |
|
|
@@ -94,6 +94,8 @@ Your model needs to be built from arithmetic and the elementary functions the so
|
|
|
94
94
|
|
|
95
95
|
The one thing to avoid is converting a traced value back to a plain number mid-model — `float(x)`, or `np.array(params)` on the parameter list, both silently discard the derivative. `soft_compile`'s verification catches this and says so.
|
|
96
96
|
|
|
97
|
+
**Parameter scale.** SoftOpt's correction moves each parameter by at most 0.5 per step, a natural size for angles and other parameters of order 1. If your parameters live on a very different scale (pixel offsets of 0.03, prices in the thousands), rescale them to roughly ±1, or set the bound to match: `SoftOpt(n, g_delta, lr=..., newton_lo=-b, newton_hi=b)`.
|
|
98
|
+
|
|
97
99
|
If you'd rather write the derivative function yourself — because your model lives in a simulator SoftOpt can't trace, or because you want the speed of a hand-tuned implementation — pass any `g_delta(theta, delta)` that returns the exact directional derivative, and skip `soft_compile` entirely.
|
|
98
100
|
|
|
99
101
|
## Where the slope comes from: `slope="model"` or `slope="measured"`
|
|
@@ -178,6 +180,16 @@ All results below use IBM's `FakeFez` noise model via Qiskit + Aer, or realistic
|
|
|
178
180
|
|
|
179
181
|
Both run SoftOpt with its default settings on IBM's `FakeFez` noise model: `benchmarks/vqe/h4_real_molecule.py`, `benchmarks/vqe/h2_vs_cobyla.py`.
|
|
180
182
|
|
|
183
|
+
**Quantum machine learning**
|
|
184
|
+
|
|
185
|
+
| Test | Baseline | Result | Win rate |
|
|
186
|
+
|---|---|---|---|
|
|
187
|
+
| Variational quantum classifier (Iris, 4 qubits, 24 parameters), same budget of 300 readings, 20 seeds | Adam | 25% lower training loss; test accuracy on the device 70.0% vs 66.3% | 20/20 (loss), 15/20 + 3 ties (accuracy) |
|
|
188
|
+
| Variational quantum classifier (breast cancer, 8 qubits, 48 parameters), same budget, 10 seeds | Adam | 6% lower training loss; test accuracy on the device 90.0% vs 88.3% | 10/10 (loss), 7/10 + 2 ties (accuracy) |
|
|
189
|
+
| Same two classifiers | COBYLA | lower training loss (Iris 16/20, cancer 10/10); test accuracy tied | 16/20, 10/10 (loss) |
|
|
190
|
+
|
|
191
|
+
`benchmarks/qml/vqc.py --dataset iris|cancer`
|
|
192
|
+
|
|
181
193
|
**Quantum control**
|
|
182
194
|
|
|
183
195
|
| Domain | Improvement | Win rate |
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "softopt"
|
|
7
|
-
version = "0.6.
|
|
7
|
+
version = "0.6.3"
|
|
8
8
|
description = "A standalone optimizer for problems with a known computation graph, built on Klein–Maimon soft-number calculus"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "MIT" }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: softopt
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.3
|
|
4
4
|
Summary: A standalone optimizer for problems with a known computation graph, built on Klein–Maimon soft-number calculus
|
|
5
5
|
Author: Ido Angel
|
|
6
6
|
License: MIT
|
|
@@ -120,6 +120,8 @@ Your model needs to be built from arithmetic and the elementary functions the so
|
|
|
120
120
|
|
|
121
121
|
The one thing to avoid is converting a traced value back to a plain number mid-model — `float(x)`, or `np.array(params)` on the parameter list, both silently discard the derivative. `soft_compile`'s verification catches this and says so.
|
|
122
122
|
|
|
123
|
+
**Parameter scale.** SoftOpt's correction moves each parameter by at most 0.5 per step, a natural size for angles and other parameters of order 1. If your parameters live on a very different scale (pixel offsets of 0.03, prices in the thousands), rescale them to roughly ±1, or set the bound to match: `SoftOpt(n, g_delta, lr=..., newton_lo=-b, newton_hi=b)`.
|
|
124
|
+
|
|
123
125
|
If you'd rather write the derivative function yourself — because your model lives in a simulator SoftOpt can't trace, or because you want the speed of a hand-tuned implementation — pass any `g_delta(theta, delta)` that returns the exact directional derivative, and skip `soft_compile` entirely.
|
|
124
126
|
|
|
125
127
|
## Where the slope comes from: `slope="model"` or `slope="measured"`
|
|
@@ -204,6 +206,16 @@ All results below use IBM's `FakeFez` noise model via Qiskit + Aer, or realistic
|
|
|
204
206
|
|
|
205
207
|
Both run SoftOpt with its default settings on IBM's `FakeFez` noise model: `benchmarks/vqe/h4_real_molecule.py`, `benchmarks/vqe/h2_vs_cobyla.py`.
|
|
206
208
|
|
|
209
|
+
**Quantum machine learning**
|
|
210
|
+
|
|
211
|
+
| Test | Baseline | Result | Win rate |
|
|
212
|
+
|---|---|---|---|
|
|
213
|
+
| Variational quantum classifier (Iris, 4 qubits, 24 parameters), same budget of 300 readings, 20 seeds | Adam | 25% lower training loss; test accuracy on the device 70.0% vs 66.3% | 20/20 (loss), 15/20 + 3 ties (accuracy) |
|
|
214
|
+
| Variational quantum classifier (breast cancer, 8 qubits, 48 parameters), same budget, 10 seeds | Adam | 6% lower training loss; test accuracy on the device 90.0% vs 88.3% | 10/10 (loss), 7/10 + 2 ties (accuracy) |
|
|
215
|
+
| Same two classifiers | COBYLA | lower training loss (Iris 16/20, cancer 10/10); test accuracy tied | 16/20, 10/10 (loss) |
|
|
216
|
+
|
|
217
|
+
`benchmarks/qml/vqc.py --dataset iris|cancer`
|
|
218
|
+
|
|
207
219
|
**Quantum control**
|
|
208
220
|
|
|
209
221
|
| Domain | Improvement | Win rate |
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|