ad_hoc_data#
- 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
ZZFeatureMap
according to the procedure outlined in [1]. To construct the dataset, we first sample uniformly distributed vectors and apply the feature mapwhere
and
We then attribute labels to the vectors according to the rule
where
is the separation gap, and 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_size (int) -- the number of training samples.
test_size (int) -- the number of testing samples.
n (int) -- number of qubits (dimension of the feature space). Must be 2 or 3.
gap (int) -- separation gap (
).plot_data (bool) -- whether to plot the data. Requires matplotlib.
one_hot (bool) -- if True, return the data in one-hot format.
include_sample_total (bool) -- if True, return all points in the uniform grid in addition to training and testing samples.
- प्रदत्त :
Training and testing samples.
- उभारता है :
ValueError -- if n is not 2 or 3.
- प्रदत्त प्रकार :
Tuple[ndarray, ndarray, ndarray, ndarray] | Tuple[ndarray, ndarray, ndarray, ndarray, ndarray]