deepof_experiments.smk 4.67 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
# @authors lucasmiranda42
# encoding: utf-8
# deepof_experiments

"""

Snakefile for data and imputation.
Execution: sbatch snakemake
Plot DAG: snakemake --snakefile deepof_experiments.smk --forceall --dag | dot -Tpdf > deepof_experiments_DAG.pdf
Plot rule graph: snakemake --snakefile deepof_experiments.smk --forceall --rulegraph | dot -Tpdf > deepof_experiments_RULEGRAPH.pdf

"""

14
import os
15

lucas_miranda's avatar
lucas_miranda committed
16
outpath = "/psycl/g/mpsstatgen/lucas/DLC/DLC_autoencoders/DeepOF/deepof/logs/"
17
18
losses = ["ELBO"]  # , "MMD", "ELBO+MMD"]
encodings = [4, 6, 8]  # [2, 4, 6, 8, 10, 12, 14, 16]
lucas_miranda's avatar
lucas_miranda committed
19
cluster_numbers = [10, 15, 20]  # [1, 5, 10, 15, 20]
20
pheno_weights = [0.01, 0.1, 0.25, 0.5, 1.0, 2.0, 4.0, 10.0, 100.0]
21

22

23
24
rule deepof_experiments:
    input:
lucas_miranda's avatar
lucas_miranda committed
25
26
        expand( "/psycl/g/mpsstatgen/lucas/DLC/DLC_autoencoders/DeepOF/deepof/logs/hyperparameter_tuning/trained_weights/"
                "GMVAE_loss={loss}_encoding=2_run_1_final_weights.h5",
lucas_miranda's avatar
lucas_miranda committed
27
28
29
30
                loss=losses,
        )

        # expand(
lucas_miranda's avatar
lucas_miranda committed
31
        #     "/psycl/g/mpsstatgen/lucas/DLC/DLC_autoencoders/DeepOF/deepof/logs/dimension_and_loss_experiments/trained_weights/"
lucas_miranda's avatar
lucas_miranda committed
32
33
34
35
36
        #     "GMVAE_loss={loss}_encoding={encs}_k={k}_run_1_final_weights.h5",
        #     loss=losses,
        #     encs=encodings,
        #     k=cluster_numbers,
        # ),
lucas_miranda's avatar
lucas_miranda committed
37
        # expand(
lucas_miranda's avatar
lucas_miranda committed
38
        #     "/psycl/g/mpsstatgen/lucas/DLC/DLC_autoencoders/DeepOF/deepof/logs/pheno_classification_experiments/trained_weights/"
lucas_miranda's avatar
lucas_miranda committed
39
40
41
42
43
44
        #     "GMVAE_loss={loss}_encoding={encs}_k={k}_pheno={phenos}_run_1_final_weights.h5",
        #     loss=losses,
        #     encs=encodings,
        #     k=cluster_numbers,
        #     phenos=pheno_weights,
        # ),
45
46


lucas_miranda's avatar
lucas_miranda committed
47
rule coarse_hyperparameter_tuning:
48
    input:
lucas_miranda's avatar
lucas_miranda committed
49
        data_path="/psycl/g/mpsstatgen/lucas/DLC/DLC_models/deepof_single_topview/",
50
    output:
51
        trained_models=os.path.join(
52
            outpath,
lucas_miranda's avatar
lucas_miranda committed
53
            "hyperparameter_tuning/trained_weights/GMVAE_loss={loss}_encoding=2_run_1_final_weights.h5",
54
        ),
55
    shell:
56
57
        "pipenv run python -m deepof.train_model "
        "--train-path {input.data_path} "
lucas_miranda's avatar
lucas_miranda committed
58
59
        "--val-num 25 "
        "--components 15 "
60
61
        "--input-type coords "
        "--predictor 0 "
lucas_miranda's avatar
lucas_miranda committed
62
        "--phenotype-classifier 0 "
63
64
65
        "--variational True "
        "--loss {wildcards.loss} "
        "--kl-warmup 20 "
lucas_miranda's avatar
lucas_miranda committed
66
67
        "--mmd-warmup 0 "
        "--encoding-size 2 "
68
        "--batch-size 256 "
69
        "--window-size 24 "
lucas_miranda's avatar
lucas_miranda committed
70
71
72
73
        "--window-step 12 "
        "--output-path {outpath}coarse_hyperparameter_tuning "
        "--hyperparameter-tuning hyperband "
        "--hpt-trials 3"
74
75


lucas_miranda's avatar
lucas_miranda committed
76
77
# rule explore_encoding_dimension_and_loss_function:
#     input:
lucas_miranda's avatar
lucas_miranda committed
78
#         data_path=ancient("/psycl/g/mpsstatgen/lucas/DLC/DLC_models/deepof_single_topview/"),
lucas_miranda's avatar
lucas_miranda committed
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#     output:
#         trained_models=os.path.join(
#             outpath,
#             "dimension_and_loss_experiments/trained_weights/GMVAE_loss={loss}_encoding={encs}_k={k}_run_1_final_weights.h5",
#         ),
#     shell:
#         "pipenv run python -m deepof.train_model "
#         "--train-path {input.data_path} "
#         "--val-num 5 "
#         "--components {wildcards.k} "
#         "--input-type coords "
#         "--predictor 0 "
#         "--phenotype-classifier 0 "
#         "--variational True "
#         "--loss {wildcards.loss} "
#         "--kl-warmup 20 "
#         "--mmd-warmup 20 "
#         "--montecarlo-kl 10 "
#         "--encoding-size {wildcards.encs} "
#         "--batch-size 256 "
#         "--window-size 24 "
#         "--window-step 6 "
#         "--exclude-bodyparts Tail_base,Tail_1,Tail_2,Tail_tip "
#         "--stability-check 3 "
#         "--output-path {outpath}dimension_and_loss_experiments"
#
#
# rule explore_phenotype_classification:
#     input:
lucas_miranda's avatar
lucas_miranda committed
108
#         data_path="/psycl/g/mpsstatgen/lucas/DLC/DLC_models/deepof_single_topview/",
lucas_miranda's avatar
lucas_miranda committed
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#     output:
#         trained_models=os.path.join(
#             outpath,
#             "pheno_classification_experiments/trained_weights/GMVAE_loss={loss}_encoding={encs}_k={k}_pheno={phenos}_run_1_final_weights.h5",
#         ),
#     shell:
#         "pipenv run python -m deepof.train_model "
#         "--train-path {input.data_path} "
#         "--val-num 15 "
#         "--components {wildcards.k} "
#         "--input-type coords "
#         "--predictor 0 "
#         "--phenotype-classifier {wildcards.phenos} "
#         "--variational True "
#         "--loss {wildcards.loss} "
#         "--kl-warmup 20 "
#         "--mmd-warmup 20 "
#         "--montecarlo-kl 10 "
#         "--encoding-size {wildcards.encs} "
#         "--batch-size 256 "
#         "--window-size 11 "
#         "--window-step 11 "
#         "--stability-check 3  "
#         "--output-path {outpath}pheno_classification_experiments"