Skip to content

Commit

Permalink
Add comment: Change parameters for MNIST dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
dom-lee committed Dec 12, 2022
1 parent 06541f4 commit 14495ab
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 16 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ Beyond", published in ICML 2022.
## Additional Test that we excecuted
1. **Less-separated Synthetic Dataset**: run
`python experiments.py complete`
-
- Change 'r' value at https://github.com/dom-lee/EECS553-Reproducibility-Spectral-Clustering/blob/06541f4ec59481cefdc981144c0b80f75715a451/pysc/datasets.py#L379

2. **Test on BSDS dataset with different standard deviation**: run
`python experiments.py bsds`
- We set break condition to cluster only 25 images
-

3. **Test on MNIST dataset with different number of eigenvector for embedding**:
Expand Down
33 changes: 18 additions & 15 deletions experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,23 +88,26 @@ def experiment_instance(d, nn, q):
pysc.datasets.MnistDataset(k=nn, downsample=d), 10)
q.put((d, nn, this_rand_scores, this_mut_info, this_conductances, this_times))

# We will construct the 3-NN graph for the MNIST dataset.
k = 3

# Kick off the experiment in a sub-process.
q = Queue()
p = Process(target=experiment_instance, args=(None, k, q))
p.start()
p.join()
# # We will construct the 3-NN graph for the MNIST dataset.
# k = 3

# [Hyungchan Cho] We changed k parameter from 3 to 21 to generate Graph with KNN
for k in range(3, 21):
# Kick off the experiment in a sub-process.
q = Queue()
p = Process(target=experiment_instance, args=(None, k, q))
p.start()
p.join()

# Write out the results
with open("results/mnist/results.csv", 'w') as fout:
fout.write("k, d, eigenvectors, rand\n")
# Write out the results
with open(f"results/mnist/results_k.csv", 'w') as fout:
fout.write("k, d, eigenvectors, rand\n")

while not q.empty():
downsample, k, rand_scores, _, _, _ = q.get()
for i in range(2, 11):
fout.write(f"{k}, {downsample}, {i}, {rand_scores[i]}\n")
while not q.empty():
downsample, k, rand_scores, _, _, _ = q.get()
# [Hyungchan Cho] Tested k eigenvectors from 2 to 21
for i in range(2, 21):
fout.write(f"{k}, {downsample}, {i}, {rand_scores[i]}\n")


def run_usps_experiment():
Expand Down
5 changes: 5 additions & 0 deletions results/sbm/complete_results.csv
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
k, n, p, q, poverq, eigenvectors, conductance, rand
5, 1000, 0.01, 0.001, 10.0, 1, 0.9474027622503941, 0.6574567073414683
5, 1000, 0.01, 0.001, 10.0, 2, 0.6436893037077096, 0.8146371834366872
5, 1000, 0.01, 0.001, 10.0, 3, 0.3756434337075715, 0.9512978275655131
5, 1000, 0.01, 0.001, 10.0, 4, 0.31325660254706367, 0.9812917143428687
5, 1000, 0.01, 0.001, 10.0, 5, 0.28187226965267426, 0.995807473494699

0 comments on commit 14495ab

Please sign in to comment.