Thank the authors for sharing the source code.
I wonder why test samples are used in training for early stopping and reporting the best performance.
Your code: sample_id_paths comes from test_sample_ids (which derives from the test set of current split). Is test data taken as validation data?
# using the same train sample ids for validationsample_id_paths= [
HESTDatasetPath(
name=sample_id,
h5_path=os.path.join(args.embed_dataroot, args.dataset, args.feature_encoder, f"fp32/{sample_id}.h5"),
h5ad_path=os.path.join(args.source_dataroot, args.dataset, f"adata/{sample_id}.h5ad"),
gene_list_path=os.path.join(args.source_dataroot, args.dataset, args.gene_list
),
) forsample_idintest_sample_ids
]
val_loaders= [
torch.utils.data.DataLoader(
HESTDataset(
sample_id_path, distribution="constant_1.0", normalize_method=normalize_method,
sample_times=1
),
batch_size=1, collate_fn=padding_batcher()
) forsample_id_pathinsample_id_paths
]Your code: The val_loaders (it is actually test data) is evaluated in training for early stopping and reporting the best performance. Is this the right way to evaluate the model?
val_perf_dict, pred_dump=test(args, diffusier, model, val_loaders, return_all=True)
ifval_perf_dict["all"]['pearson_mean'] >best_pearson:
best_pearson=val_perf_dict["all"]['pearson_mean']
best_val_dict=val_perf_dictforpatch_name, dataset_resinval_perf_dict.items():
withopen(os.path.join(val_save_dir, f'{patch_name}_results.json'), 'w') asf:
json.dump(dataset_res, f, sort_keys=True, indent=4)
# save_pkl(os.path.join(val_save_dir, 'inference_dump.pkl'), pred_dump)early_stop_step=0else:
early_stop_step+=1ifearly_stop_step>=20:
print("Early stopping")
break
Thank the authors for sharing the source code.
I wonder why test samples are used in training for early stopping and reporting the best performance.
Your code:
sample_id_pathscomes fromtest_sample_ids(which derives from the test set of current split). Is test data taken as validation data?Your code: The
val_loaders(it is actually test data) is evaluated in training for early stopping and reporting the best performance. Is this the right way to evaluate the model?