From 13dd754ba6ada78d0d500b80e1fd0abfc9d7f469 Mon Sep 17 00:00:00 2001 From: "Michael Pilosov, PhD" Date: Tue, 13 Feb 2024 06:46:18 +0000 Subject: [PATCH] nice set of params --- makefile | 2 +- scripts/lex_sorted_indices.npy | Bin 7720 -> 0 bytes scripts/sortcolor.py | 18 +++++++++++------- 3 files changed, 12 insertions(+), 8 deletions(-) delete mode 100644 scripts/lex_sorted_indices.npy diff --git a/makefile b/makefile index 4268fd8..3dd1b09 100644 --- a/makefile +++ b/makefile @@ -59,7 +59,7 @@ sort_umap: python scripts/sortcolor.py -s umap --dpi 300 --seed 21 parallel_umap: - parallel -j 8 python scripts/sortcolor.py -s umap --dpi 300 --seed ::: {1..8} + parallel -j 12 python scripts/sortcolor.py -s umap --dpi 300 --seed ::: $$(seq 101 112) sort_lex: python scripts/sortcolor.py -s lex --dpi 300 diff --git a/scripts/lex_sorted_indices.npy b/scripts/lex_sorted_indices.npy deleted file mode 100644 index 971bb7af3caa86f1e053f2ba4cf65bc7bf71248f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7720 zcmbWyWnVS)emU+m$L1OEMsibwvF0pH_?Py6?;uzUjD2-8LR zFCQ;oMn}h|{3JM%-x?RVb5eevUP)J^EBl_Tc7rg9{EdEb`XV;QM)s|+Fs73a#rRm? zy`*$BdLEXwpXWP{>E**&{B(MU`P=E3^4*w>-?O}d|KPn+5#P`6OTUzlp|8mo(SOQgxEn&3!$SA~ zv+8A`htQqf8-m#|rS~4`&(be}6>uXq){jru!JY1f(uv&5MIWK#;FtUtm>B8gro(*aC>$;CXjhVdnV%AC%OB$g_v+9G^ipFe|2%z*o{Jgz zIq0SCt*4{V!|)D1#K#y%f2@0re19?eH8#=fBHv@5LOzLpNAJdFc3;`A`Rx^!`RIsG+#6|dQ6@ZK$YrG6E9w|+PN zb-Es=;CIm<&#z9$rPt`CqFd2fy}y>fpN?gpRBs9WMBaujEbl}g#6EiCu@V0Z`ZPwi zpCE5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975 100644 --- a/scripts/sortcolor.py +++ b/scripts/sortcolor.py @@ -86,14 +86,16 @@ elif KIND == "umap": reducer = UMAP( n_components=1, n_neighbors=250, - min_dist=0.005, + min_dist=1e-2, metric="euclidean", random_state=SEED, + negative_sample_rate=2, ) embedding = reducer.fit_transform(np.array(rgb_values)) # Sort colors by the 1D representation preds = embedding[:, 0] + del reducer, embedding elif KIND in ("cielab", "lab", "ciede2000"): from skimage.color import deltaE_ciede2000, rgb2lab @@ -130,10 +132,11 @@ else: sorted_indices = np.argsort(preds) # Save the sorted indices to disk -if (KIND == "umap" and SEED == 21) or (KIND != "umap"): - file_path = f"scripts/{KIND}_sorted_indices.npy" - np.save(file_path, sorted_indices) - print(f"Sorted indices saved to {file_path}") +# if (KIND == "umap") or (KIND != "umap"): +Path(f"scripts/{KIND}").mkdir(parents=True, exist_ok=True) +file_path = f"scripts/{KIND}/preds_{SEED:06d}.npy" +np.save(file_path, preds) +print(f"Predictions saved to {file_path}") # Sort colors by the 1D representation sorted_colors = [colors[i] for i in sorted_indices] @@ -280,18 +283,19 @@ def plot_preds( prefix = "" if KIND == "umap": - prefix = f"{SEED:02d}" + prefix = f"{SEED:04d}" fname = f"{DIR}/{prefix}{KIND}_sorted_colors_circle.png" plot_preds( preds, np.array(rgb_values), fname, - roll=True, + roll=False, dpi=DPI, inner_radius=INNER_RADIUS, figsize=(SIZE, SIZE), ) +print(f"saved {fname}") HILBERT = False