언어
English
Bengali
French
Hindi
Italian
Japanese
Korean
Malayalam
Russian
Spanish
Tamil
Turkish
Vietnamese

ad_hoc_data(training_size, test_size, n, gap, plot_data=False, one_hot=True, include_sample_total=False)[소스]

Generates a toy dataset that can be fully separated with qiskit.circuit.library.ZZ_Feature_Map according to the procedure outlined in [1]. To construct the dataset, we first sample uniformly distributed vectors $$\vec{x} \in (0, 2\pi]^{n}$$ and apply the feature map

$|\Phi(\vec{x})\rangle = U_{{\Phi} (\vec{x})} H^{\otimes n} U_{{\Phi} (\vec{x})} H^{\otimes n} |0^{\otimes n} \rangle$

where

$U_{{\Phi} (\vec{x})} = \exp \left( i \sum_{S \subseteq [n] } \phi_S(\vec{x}) \prod_{i \in S} Z_i \right)$

and

$\begin{split}\begin{cases} \phi_{\{i, j\}} = (\pi - x_i)(\pi - x_j) \\ \phi_{\{i\}} = x_i \end{cases}\end{split}$

We then attribute labels to the vectors according to the rule

$\begin{split}m(\vec{x}) = \begin{cases} 1 & \langle \Phi(\vec{x}) | V^\dagger \prod_i Z_i V | \Phi(\vec{x}) \rangle > \Delta \\ -1 & \langle \Phi(\vec{x}) | V^\dagger \prod_i Z_i V | \Phi(\vec{x}) \rangle < -\Delta \end{cases}\end{split}$

where $$\Delta$$ is the separation gap, and $$V\in \mathrm{SU}(4)$$ is a random unitary.

The current implementation only works with n = 2 or 3.

References:

[1] Havlíček V, Córcoles AD, Temme K, Harrow AW, Kandala A, Chow JM, Gambetta JM. Supervised learning with quantum-enhanced feature spaces. Nature. 2019 Mar;567(7747):209-12. arXiv:1804.11326

매개변수:
반환 형식:
반환:

Training and testing samples.

예외 발생:

ValueError – if n is not 2 or 3.