<filename>examples/plot_hqc.py
"""
============
Plotting HQC
============

This section shows a scatterplot of the Helstrom Quantum Centroid (HQC) classifier and the Python code to generate the scatterplot.
"""
# Example
import hqc
import numpy as np
from matplotlib import pyplot as plt

X = [[0, 0], [1, 1]]
y = [0, 1]
clf = hqc.HQC()   # Using default hyperparameter values
clf.fit(X, y)

rng = np.random.RandomState(13)
X_test = rng.rand(500, 2)
y_pred = clf.predict(X_test)

X_0 = X_test[y_pred == 0]
X_1 = X_test[y_pred == 1]


p0 = plt.scatter(0, 0, c='red', s=100)
p1 = plt.scatter(1, 1, c='blue', s=100)

ax0 = plt.scatter(X_0[:, 0], X_0[:, 1], c='crimson', s=50)
ax1 = plt.scatter(X_1[:, 0], X_1[:, 1], c='deepskyblue', s=50)

leg = plt.legend([p0, p1, ax0, ax1],
                 ['Point 0', 'Point 1', 'Class 0', 'Class 1'],
                 loc='upper left', fancybox=True, scatterpoints=1)
leg.get_frame().set_alpha(0.5)

plt.xlabel('Feature 1')
plt.ylabel('Feature 2')
plt.xlim([-.5, 1.5])

plt.show()

<filename>examples/plot_hqc.py
"""
============
Plotting HQC
============

This section shows a scatterplot of the Helstrom Quantum Centroid (HQC) classifier and the Python code to generate the scatterplot.
"""
# Example
import hqc
import numpy as np
from matplotlib import pyplot as plt

X = [[0, 0], [1, 1]]
y = [0, 1]
clf = hqc.HQC()   # Using default hyperparameter values
clf.fit(X, y)

rng = np.random.RandomState(13)
X_test = rng.rand(500, 2)
y_pred = clf.predict(X_test)

X_0 = X_test[y_pred == 0]
X_1 = X_test[y_pred == 1]


p0 = plt.scatter(0, 0, c='red', s=100)
p1 = plt.scatter(1, 1, c='blue', s=100)

ax0 = plt.scatter(X_0[:, 0], X_0[:, 1], c='crimson', s=50)
ax1 = plt.scatter(X_1[:, 0], X_1[:, 1], c='deepskyblue', s=50)

leg = plt.legend([p0, p1, ax0, ax1],
                 ['Point 0', 'Point 1', 'Class 0', 'Class 1'],
                 loc='upper left', fancybox=True, scatterpoints=1)
leg.get_frame().set_alpha(0.5)

plt.xlabel('Feature 1')
plt.ylabel('Feature 2')
plt.xlim([-.5, 1.5])

plt.show()

============
 Plotting HQC
 ============
 
 This section shows a scatterplot of the Helstrom Quantum Centroid (HQC) classifier and the Python code to generate the scatterplot. # Example # Using default hyperparameter values