Comments (9)
Explore the package https://qiskit.org/documentation/stubs/qiskit.algorithms.optimizers.html
For instance, SPSA
is also gradient free. It estimates gradient without direct invocations of the gradient framework. If it is unclear from the documentation, you may query gradient_support_level
:
opt = COBYLA()
opt.gradient_support_level
Out[13]: <OptimizerSupportLevel.ignored: 1>
opt = ADAM()
opt.gradient_support_level
Out[16]: <OptimizerSupportLevel.supported: 2>
from qiskit-machine-learning.
Can you please share more details?
from qiskit-machine-learning.
@adekusar-drl As above, I said installed the library module then tried to try an example on ReadMe but got the same error as above. That is what I want to say
from qiskit-machine-learning.
Thanks for noting this. This is not an error, but rather a warning in this case. We use COBYLA
optimizer in this example, which is gradient free, so the example is still good.
from qiskit-machine-learning.
@adekusar-drl
sorry for bothering ... but the COBYLA
optimizer still shows the same warnning for me(Cannot compute gradient operator! Continuing without gradients)
any idea how this may be fixed ?
note: i have the latest version of qisktit
from qiskit-machine-learning.
@moustafa7zada In general, it is just a warning, not an error. That means, the code with this warning may still work correctly. Even if you use COBYLA
you may see this warning. Since COBYLA
is a gradient free optimizer, it does not require gradient evaluation, hence gradient is not required. Without seeing the code I can't say more about this issue.
from qiskit-machine-learning.
@adekusar-drl
thanks a lot for your help :) ..the code looks like this
num_qubits = 2
depth = 4
theta = ParameterVector('\u03B8', length=num_qubits) # creating a list of Parameters
custom_circ = QuantumCircuit(num_qubits)
for _ in range(depth) :
for i in range(num_qubits):
custom_circ.rx(theta[i], i)
for j in range(num_qubits):
for k in range(j) :
custom_circ.cx(k , j)
custom_circ.barrier()
qc = RawFeatureVector(4)
my_opt = COBYLA(maxiter=500, tol=0.001)
vqc = VQC(optimizer=my_opt , feature_map =qc , ansatz = custom_circ )
from qiskit-machine-learning.
@moustafa7zada the reason is RawFeatureVector
. The model can be trained using gradient free optimizers.
from qiskit-machine-learning.
@adekusar-drl Okay i will go with COBYLA
... thank you for your time.
just one last question . is COBYLA
the only gradient free optimizer in qiskit?
from qiskit-machine-learning.
Related Issues (20)
- Enhancement of PyTorch connector HOT 2
- Extend unit test coverage with `Hypothesis` in numerical tests
- Add `jit` compilation to the Torch connector with `thunder`
- Revamp `README.md` with structured information HOT 4
- Set up a security policy (@maintainers)
- Multi-class Classification Problem Using QSVC HOT 3
- Error when testing samples with labels other than {0, 1} in the MNIST dataset. HOT 6
- Revert CI environment to latest PyTorch once UTF bug is fixed
- Binary classification problem using NeuralNetworkClassifier and cross entropy loss HOT 1
- MacOS in CI - macos-latest is now ARM HOT 2
- Link Qiskit 1.0 migration instructions in Readme
- Add support for EstimatorV2 from ibm-qiskit-runtime to run circuits over hardware HOT 1
- Migrate `qiskit_algorithms` following end-of-support HOT 2
- Pinned `torch==2.2.2` breaks CI due to `numpy>=2.0`
- NeuralNetworkClassifier Accuracy Updates HOT 2
- Revert Numpy to the latest version in CI environment once UTF bug in PyTorch is fixed
- Restore mypy checks on Windows and lowest Numpy version
- The return values from SamplerQNN are in the wrong shape.
- Separate parameters for the trainable part and the encoding part in EstimatorQNN
- Mismatching between loss function code and documentation formula
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qiskit-machine-learning.