Skip to content

Commit

Permalink
Bug/validation samples (#139)
Browse files Browse the repository at this point in the history
* correct the selection of training and validation samples

* write training stdout and stdin to cv_split* directories

---------

Co-authored-by: Brian Clarke <[email protected]>
  • Loading branch information
bfclarke and bfclarke authored Oct 11, 2024
1 parent f5bcecf commit ad7fcb3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
14 changes: 5 additions & 9 deletions deeprvat/deeprvat/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,18 +439,14 @@ def __getitem__(self, index):
assert np.array_equal(idx, np.arange(idx[0], idx[-1] + 1))
slice_ = slice(idx[0], idx[-1] + 1)

# annotations = (
# self.data[pheno]["input_tensor"][slice_]
# if self.cache_tensors
# else self.data[pheno]["input_tensor_zarr"][slice_, :, :, :]
# )
annotations = self.data[pheno]["input_tensor_zarr"][slice_, :, :, :]
indices = self.samples[pheno][slice_]
annotations = self.data[pheno]["input_tensor_zarr"].oindex[indices, :, :, :]

result[pheno] = {
"indices": self.samples[pheno][slice_],
"covariates": self.data[pheno]["covariates"][slice_],
"indices": indices,
"covariates": self.data[pheno]["covariates"][indices],
"rare_variant_annotations": torch.tensor(annotations),
"y": self.data[pheno]["y"][slice_],
"y": self.data[pheno]["y"][indices],
}

return result
Expand Down
2 changes: 1 addition & 1 deletion pipelines/training/train.snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ rule train:
mem_mb = 20000,
gpus = 1
shell:
f"parallel --jobs {n_parallel_training_jobs} --halt now,fail=1 --results train_repeat{{{{1}}}}_trial{{{{2}}}}/ "
f"parallel --jobs {n_parallel_training_jobs} --halt now,fail=1 --results {{params.prefix}}/train_repeat{{{{1}}}}_trial{{{{2}}}}/ "
'deeprvat_train train ' +
debug +
deterministic +
Expand Down

0 comments on commit ad7fcb3

Please sign in to comment.