# Basis encoding example with PennyLane
import pandas as pd
import pennylane as qml
from pennylane import numpy as np
# import the template
from pennylane.templates.layers import StronglyEntanglingLayers
from sklearn.utils import shuffle
from sklearn.preprocessing import normalize
from pennylane.templates.embeddings import AngleEmbedding, BasisEmbedding, AmplitudeEmbedding, DisplacementEmbedding
from pennylane.init import strong_ent_layers_uniform

np.random.seed(42)

# Constants
DATA_PATH = "../../Data/Processed/data.csv"
num_qubits = 4

data = pd.read_csv(DATA_PATH)

X, Y = data[['sex', 'cp', 'exang', 'oldpeak']].values, data['num'].values

# normalize the data
X = normalize(X)
print(X[:5])



device = qml.device("default.qubit", wires=num_qubits)

@qml.qnode(device)
def circuit(data):
    for i in range(num_qubits):
        # Create superposition
        qml.Hadamard(wires=i)
    AngleEmbedding(features=data, wires=range(num_qubits), rotation="Y")
    return qml.expval(qml.PauliZ(0)), qml.expval(qml.PauliZ(1)), qml.expval(qml.PauliZ(2)), qml.expval(qml.PauliZ(3))

circuit(X[0])

