Skip to content

Commit 9eb1090

Browse files
authored
Merge pull request #19 from XanaduAI/dev-joseph
small fixes
2 parents d7ec895 + 707f48b commit 9eb1090

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/qml_benchmarks/data/bars_and_stripes.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,21 @@ def generate_bars_and_stripes(n_samples, height, width, noise_std):
2323
height (int): number of pixels for image height
2424
width (int): number of pixels for image width
2525
noise_std (float): standard deviation of Gaussian noise added to the pixels
26+
Returns:
27+
(array): data labels. -1 corresponds to a bar, +1 to a stripe.
2628
"""
2729
X = np.ones([n_samples, 1, height, width]) * -1
2830
y = np.zeros([n_samples])
2931

3032
for i in range(len(X)):
3133
if np.random.rand() > 0.5:
32-
rows = np.where(np.random.rand(width) > 0.5)[0]
34+
rows = np.where(np.random.rand(height) > 0.5)[0]
3335
X[i, 0, rows, :] = 1.0
34-
y[i] = -1
36+
y[i] = +1
3537
else:
36-
columns = np.where(np.random.rand(height) > 0.5)[0]
38+
columns = np.where(np.random.rand(width) > 0.5)[0]
3739
X[i, 0, :, columns] = 1.0
38-
y[i] = +1
40+
y[i] = -1
3941
X[i, 0] = X[i, 0] + np.random.normal(0, noise_std, size=X[i, 0].shape)
4042

4143
return X, y

src/qml_benchmarks/models/quanvolutional_neural_network.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def __init__(
7777
jit=True,
7878
learning_rate=0.001,
7979
max_steps=10000,
80-
convergence_interval=10e-4,
80+
convergence_interval=200,
8181
batch_size=32,
8282
random_state=42,
8383
scaling=1.0,

0 commit comments

Comments
 (0)