Install libraries and import packages. The dataset is imported through sklearn.datasets using fetch_openml.
Load dataset and preprocess. The heating load target is binarized at the median and 4 features are selected. Non-numeric values are converted into numerical. The DataFrame is created.
The coorlelation between each feature and the target is calculated via Pearson Coorleation calculation. The selected features of V1, V3, V4, and V5 have the highest coorelation values.
Selected features are scaled to [0,π]. The feature matrix X and target vector y are defined. Data is split according to the standard 80% training and 20% testing split to preserve class balance.
Instantiate the SVM model then fit onto the training data. CML training commences.
Make predictions on the test set, whether the target of data point is high or low load. These labels are then compared against the true labels to assess CML accuracy. Additional metrics are outputted.
All test and train data is converted to numpy arrays to be compatible with Qiskit. A ZZFeatureMap is instatiated to encode the 4 features into quantum states. A Fidelity-based quantum kernel is instantiated which works by encoding a data point into the quantum circuit before encoding another data point. The overlap (fidelity) between the two quantum states is measured, which essentially produces a similarity score. This is how the hyperplane is formed.
QSVM is instantiated and training commences.
Make predictions on the test set, whether the target of data point is high or low load. These labels are then compared against the true labels to assess QML accuracy.
A bar chart displaying the accuracies of CML and QML side by side is generated using MATLAB.