Closed mickahell closed 2 years ago
Cross-posting from Slack & expanding.
To build up a quantum kernel matrix, we're going to need to use some parameterized quantum circuits (PQCs).
A good way to do this is using the Qiskit Circuit Library, especially the TwoLocal
circuit
In our study, we used a variety of circuits from this paper ("Sim et al.). For this work, we don't have to do that. I would suggest the following circuits from the SIm et al. paper (see Figure 2):
We can pick a modest number of qubits (e.g., 2-10) or so. There's no reason, AFAIK, to go crazy with this.
In addition, in terms of the number of "layers" (terminology from Sim et al.) or "reps" (in TwoLocal
documentation), we could fix that to be 1 for simplicity and then expand if we think that's an interesting direction to go.
Because we have to insert ("bind") parameters to these circuits, it's also crucial for reproducibility purposes that we fix the seed of whatever random number generator we are using.
With respect to generating the matrices themselves, I suggest first generating data files containing each kernel matrix element as its own row, with corresponding metadata. For starters, I suggest doing ideal (statevector) simulation; the data files would look something like this: suppose we are doing simulations of circuit ID id
. The data file could be called kernels-[id]-ideal.csv
, and would contain the following:
width | layers | seed1 | seed2 | kernel |
---|
where seed1
and seed2
are the seed values used to generate the parameter bindings for the circuit used to calculate the kernel.
NOTE: We found it necessary to use a different file format, feather, which we found necessary to facilitate storage of the data files.
Notice that seed1
and seed2
would range over values 1, 2, ...., D, meaning that the largest kernel matrix we could extract from this data is DxD. I think we got up to D=1000 and then realized it just took too long to generate more data.
Using this data, we can then mock up different realizations of quantum kernel matrices by sampling from this data set. In particular, if seed1
and seed2
range from 1,2,... , D, then to generate an s x s kernel matrix, we can randomly sample a choice of integers of size s, and then subsample the data file to values of seed1
and seed2
in that choice.
Ok, I think I see your point. Maybe it could be easier and more reproductible to split the program in 3 to have :
for the program first as jupyter notebook, I think that the best for viewing result and studying. And a self program to generate lot of data from GitHub Actions if need.
In the tab, are we agree that kernel means quantum circuit ?
yes, we should separate out the task of "generate a bunch of data for quantum kernel matrices" from the task of "do matrix completion".
The word "kernel" is probably a poor choice in the table, since it's going to get confused with "kernel matrix" or the like. We can use the word "fidelity" instead, since a quantum kernel can be thought of as a measure of fidelity (similarity) between two quantum states.
Let's create another issue ;)
Oooooh you mean the state of the hamiltonian or the state of the Qubit between -1 and 1, ok I see
No, I mean a measure of the overlap between two quantum states: Fidelity(psi0, psi1) = |<psi0|psi1>|^2.
Ok, so running multiple times the same circuit and check the % of difference of each result ? Or do you mean the % of the state in the bloch sphere ?
For the circuits we're using, the fidelity is the same as "What is the probability of obtaining the all-zeros (000...0000) bitstring"?
See Equation 3 of https://arxiv.org/abs/2112.08449
Oooooh ok the % of having the "good" result.
But how can we define that the perfect result for our circuit is all 0 or all 1 or 000010000, ... ?
Hmm, if we run it with simulator normally the perfect result will always be the most present also more shots we gave more the perfect result will be stable.
So never mind my last question
Let's take an example. Suppose I prepare a qubit in the |0> state, and apply a Hadamard gate to it. Then, I measure the qubit.
The exact outcome probabilities for this circuit are Pr(0) = Pr(1) = .5
Whether a 0 or a 1 is the desired result depends on how I post-processes my measurement outcomes.
For quantum kernels, the all-zero bitstring is the good outcome by fiat (definition). It's just how it's been defined.
You are right to point out that in the presence of noise (either finite-sampling [statistical] noise, or hardware noise), then for a given circuit the empirical probabilities (number of outcomes divided by shots) will be different than the ideal/exact/statevector/outcome probabilities.
But that doesn't need to change how we define what a "good" outcome is.
Ok i didn't realize for us that an all 000 bitstring is our result in anycase. For me it was depending in our data in input.
And I'm just totally blind, that's written right below the equation 3 in the paper:
The value of k(xl, xm) can be estimated by directly implementing the circuit U(xm)U†(xl) on the |0⊗wi> state and then estimating the probability of obtaining the all-zeros bitstring
Sorry for this dumb question ^^'
Add a question :
]0 --> u --> full [
For 200 matrix
For 500 matrix
Experiments
Package who can help : Chordal Matrix Package
Fix a size as
N' = N + n
(ie.N = 6
,n = 3
)n
) entries, can be overlappingu
or ...For each
u
look at time to solutionFor time to solution, look at regime where
N'
?EPIC #5