Skip to content

Commit 62ee214

Browse files
committed
adjust int. plots
1 parent f0713e8 commit 62ee214

3 files changed

Lines changed: 13 additions & 18 deletions

File tree

bioencoder/scripts/interactive_plots.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def interactive_plots(
6161
"valid_batch_size": hyperparams.get("dataloaders", {}).get("valid_batch_size",1),
6262
}
6363
num_workers = hyperparams.get("dataloaders", {}).get("num_workers", 4)
64-
perplexity = hyperparams.get("perplexity", 30)
64+
perplexity = hyperparams.get("perplexity")
6565

6666
plot_config = {
6767
"color_classes": hyperparams.get("color_classes", None),
@@ -71,11 +71,13 @@ def interactive_plots(
7171
}
7272

7373

74-
## Set up directories
74+
## directories and file management
7575
data_dir = os.path.join(root_dir, "data", run_name)
76-
plot_path = os.path.join(root_dir, "plots", run_name, f"embeddings_{run_name}.html")
76+
plot_dir = os.path.join(root_dir, "plots", run_name)
77+
os.makedirs(plot_dir, exist_ok=True)
78+
plot_path = os.path.join(plot_dir, "embeddings_interactive_plot.html")
7779
if not overwrite and not kwargs.get("ret_embeddings"):
78-
assert not os.path.isfile(plot_path), f"File exists: {plot_path}"
80+
assert not os.path.isfile(plot_path), f"File already exists: {plot_path}"
7981

8082
## Load model and set up
8183
print(f"Checkpoint: using {checkpoint} of {stage} stage")

bioencoder/vis/helpers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def embbedings_dimension_reductions(data_table, perplexity):
242242
return np.hstack((pca, tsne)), names, pca_obj
243243

244244

245-
def bokeh_plot(df, out_path='plot.html', color_map="viridis", color_classes=None, plot_style=1,
245+
def bokeh_plot(df, out_path='plot.html', color_map="jet1", color_classes=None, plot_style=1,
246246
point_size=10, **kwargs):
247247
"""
248248
Plot a scatter plot of the PCA and t-SNE dimensions of the data using bokeh.
@@ -265,7 +265,6 @@ class labels of the images).
265265

266266
unique_classes = df['class'].unique()
267267

268-
269268
## Color management
270269
if color_classes:
271270
assert len(unique_classes) == len(color_classes), (

bioencoder_configs/plot_stage1.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,15 @@ model:
44
stage: first # Training stage: 'first' for initial training, 'second' for fine-tuning
55

66
dataloaders:
7-
train_batch_size: 2 # Batch size for training data; ensure validation set size is a multiple of this number
8-
valid_batch_size: 2 # Batch size for validation data
9-
num_workers: 32 # Number of CPU threads for data loading; should not exceed the number of CPU cores
10-
11-
img_size: 384 # Image size for training and validation
7+
train_batch_size: # Larger is faster but may drop leftover data points - no value or removing this line will not include training data
8+
valid_batch_size: 10 # Larger is faster but may drop leftover data points - ideally use a multiple of val set size
9+
num_workers: 32 # Should not exceed available CPU cores
1210

1311
plot_style: 1 # (1: pictogram above point, 2: pictogram next to plot panel)
14-
15-
color_classes: # overrides color_map
16-
#class1: "#FFD467"
17-
#class2: "#4DC9F2"
18-
1912
point_size: 10 ## size of points in scatter plot
20-
2113
color_map: 'Set1' # Default color map; see https://matplotlib.org/stable/users/explain/colors/colormaps.html for options
22-
14+
#color_classes: # overrides color_map
15+
#class1: "#FFD467"
16+
#class2: "#4DC9F2"
2317

2418

0 commit comments

Comments
 (0)