entanglement_concentration_data¶
- entanglement_concentration_data(training_size, test_size, n, *, mode='easy', one_hot=True, include_sample_total=False, sampling_method='cardinal', class_labels=None, formatting='ndarray')[source]¶
Generates a dataset that comprises Quantum States with two different amounts of Concentration of Entanglement (CE) and their corresponding class labels. These states are generated by the effect of two different pre-trained ansatz on fully separable input states according to the procedure outlined in [1]. Pre-trained data in courtesy of L Schatzki et al [3]. The datapoints can be fully separated using the SWAP test outlined in [2]. First, input states are randomly generated from a uniform distribution, using a sampling method determined by the
sampling_methodargument. Next, based on themodeargument, two pre-trained circuits, “A” and “B” are used for generating datapoints.CE can be interpreted as a measure of correlation between the different qubits. The
modeargument supports two options."easy"gives datapoints with high CE difference, hence being easy to separate."hard"mode gives closer CE values. The user’s classifiers can be benchmarked against these modes for their ability to separate the data into two classes based on CE.Current implementation supports only
nvalues of 3 and 4.sampling_methodargument supports two options."isotropic"and"cardinal". Isotropic generates qubit states that are sampled randomly in the Bloch Sphere and takes the tensor product of all the qubits to build the input state. Cardinal generates only states that fall on the axes of the Bloch Sphere before taking the tensor product.References:
[1] Schatzki L, Arrasmith A, Coles PJ, Cerezo M. Entangled datasets for quantum machine learning. arXiv preprint. 2021 Sep; arXiv:2109.03400. https://arxiv.org/abs/2109.03400
[2] Beckey JL, Gigena N, Coles PJ, Cerezo M. Computable and operationally meaningful multipartite entanglement measures. Physical Review Letters. 2021 Sep 27; 127(14):140501. doi:10.1103/PhysRevLett.127.140501 https://doi.org/10.1103/PhysRevLett.127.140501
[3] Schatzki L. NTangled Datasets - Hardware Efficient [dataset]. GitHub. 2022 Mar 2 (commit f3a68ff). https://github.com/LSchatzki/NTangled_Datasets/tree/main/Hardware_Efficient
- Parameters:
training_size (int) – Number of training samples per class.
test_size (int) – Number of testing samples per class.
n (int) – Number of qubits (dimension of the feature space). Current implementation supports only 3, 4 and 8
mode (str) –
Choices are:
"easy": uses CE values 0.18 and 0.40 for n = 3 and 0.12 and 0.43 for n = 4"hard": uses CE values 0.28 and 0.40 for n = 3 and 0.22 and 0.34 for n = 4
Default is
"easy".one_hot (bool) – If True, returns labels in one-hot format. Default is True.
include_sample_total (bool) – If True, the function also returns the total number of accepted samples. Default is False.
sampling_method (str) –
The method used to generate input states. Choices are:
"isotropic": samples qubit states uniformly in the bloch sphere"cardinal": samples qubit states out of the 6 axes of bloch sphere
Default is
"cardinal".class_labels (list | None) – Custom labels for the two classes when one-hot is not enabled. If not provided, the labels default to
0and+1formatting (str) –
The format in which datapoints are given. Choices are:
"ndarray": gives a numpy array of shape (n_points, 2**n_qubits, 1)"statevector": gives a python list of Statevector objects
Default is
"ndarray".
- Returns:
Tuple containing the following:
training_features :
np.ndarray|qiskit.quantum_info.Statevectortraining_labels :
np.ndarraytesting_features :
np.ndarray|qiskit.quantum_info.Statevectortesting_labels :
np.ndarray
If
include_sample_total=True, a fifth element (np.ndarray) is included that specifies the total number of accepted samples.- Return type:
tuple[ndarray, ndarray, ndarray, ndarray] | tuple[ndarray, ndarray, ndarray, ndarray, ndarray] | tuple[list[Statevector], ndarray, list[Statevector], ndarray] | tuple[list[Statevector], ndarray, list[Statevector], ndarray, ndarray]