Commit 8aaccee7 authored by lucas_miranda's avatar lucas_miranda
Browse files

Added extra branch to main autoencoder for rule_based prediction

parent 3b3bea35
......@@ -14,17 +14,24 @@ Plot rule graph: snakemake --snakefile deepof_experiments.smk --forceall --ruleg
import os
outpath = "/psycl/g/mpsstatgen/lucas/DLC/DLC_autoencoders/DeepOF/deepof/logs/"
losses = ["ELBO" , "MMD", "ELBO+MMD"]
encodings = [2, 4, 6, 8, 10, 12, 14, 16]
cluster_numbers = [25] # [1, 5, 10, 15, 20, 25]
latent_reg = ["none", "categorical", "variance", "categorical+variance"]
entropy_knn = [20, 50, 80, 100]
pheno_weights = [0.01, 0.1, 0.25, 0.5, 1.0, 2.0, 4.0, 10.0, 100.0]
losses = ["ELBO" , "MMD", "ELBO+MMD"]
encodings = [6] # [2, 4, 6, 8, 10, 12, 14, 16]
cluster_numbers = [25] # [1, 5, 10, 15, 20, 25]
latent_reg = ["none"] # ["none", "categorical", "variance", "categorical+variance"]
entropy_knn = [100]
next_sequence_pred_weights = [0.0, 0.15, 0.30]
phenotype_pred_weights = [0.0, 0.15]
rule_based_pred_weights = [0.0, 0.15, 0.30]
input_types = ["coords"]
run = list(range(1, 11))
rule deepof_experiments:
input:
# Elliptical arena detection
# "/psycl/g/mpsstatgen/lucas/DLC/DLC_autoencoders/DeepOF/deepof/supplementary_notebooks/recognise_elliptical_arena.ipynb",
# Hyperparameter tuning
# expand(
# os.path.join(
# outpath,
......@@ -34,24 +41,22 @@ rule deepof_experiments:
# k=cluster_numbers,
# enc=encodings,
# ),
# Train a variety of models
expand(
"/psycl/g/mpsstatgen/lucas/DLC/DLC_autoencoders/DeepOF/deepof/logs/latent_regularization_experiments/trained_weights/"
"/psycl/g/mpsstatgen/lucas/DLC/DLC_autoencoders/DeepOF/deepof/logs/train_models/trained_weights/"
"GMVAE_loss={loss}_encoding={encs}_k={k}_latreg={latreg}_entropyknn={entknn}_final_weights.h5",
input_type=input_types,
loss=losses,
encs=encodings,
k=cluster_numbers,
latreg=latent_reg,
entknn=entropy_knn,
nspredweight=next_sequence_pred_weights,
phenpredweight=phenotype_pred_weights,
rulesweight=rule_based_pred_weights,
run=run,
),
# expand(
# "/psycl/g/mpsstatgen/lucas/DLC/DLC_autoencoders/DeepOF/deepof/logs/pheno_classification_experiments/trained_weights/"
# "GMVAE_loss={loss}_encoding={encs}_k={k}_pheno={phenos}_run_1_final_weights.h5",
# loss=losses,
# encs=encodings,
# k=cluster_numbers,
# phenos=pheno_weights,
# ),
rule elliptical_arena_detector:
input:
......@@ -80,12 +85,13 @@ rule coarse_hyperparameter_tuning:
"--val-num 25 "
"--components {wildcards.k} "
"--input-type coords "
"--predictor 0 "
"--phenotype-classifier 0 "
"--next-sequence-prediction {wildcards.nspredweight} "
"--phenotype-prediction {wildcards.phenpredweight} "
"--rule-based-prediction {wildcards.rulesweight} "
"--variational True "
"--loss {wildcards.loss} "
"--kl-warmup 20 "
"--mmd-warmup 0 "
"--kl-warmup 5 "
"--mmd-warmup 5 "
"--encoding-size {wildcards.enc} "
"--batch-size 256 "
"--window-size 24 "
......@@ -95,7 +101,7 @@ rule coarse_hyperparameter_tuning:
"--hpt-trials 1"
rule latent_regularization_experiments:
rule train_models:
input:
data_path=ancient(
"/psycl/g/mpsstatgen/lucas/DLC/DLC_models/deepof_single_topview/"
......@@ -108,11 +114,12 @@ rule latent_regularization_experiments:
shell:
"pipenv run python -m deepof.train_model "
"--train-path {input.data_path} "
"--val-num 5 "
"--val-num 15 "
"--components {wildcards.k} "
"--input-type coords "
"--predictor 0 "
"--phenotype-classifier 0 "
"--input-type {wildcards.input_type} "
"--next-sequence-prediction {wildcards.nspredweight} "
"--phenotype-prediction {wildcards.phenpredweight} "
"--rule-based-prediction {wildcards.rulesweight} "
"--variational True "
"--latent-reg {wildcards.latreg} "
"--loss {wildcards.loss} "
......@@ -124,35 +131,7 @@ rule latent_regularization_experiments:
"--batch-size 256 "
"--window-size 24 "
"--window-step 12 "
"--run {wildcards.run}"
"--output-path {outpath}latent_regularization_experiments"
# "--exclude-bodyparts Tail_base,Tail_1,Tail_2,Tail_tip "
rule explore_phenotype_classification:
input:
data_path="/psycl/g/mpsstatgen/lucas/DLC/DLC_models/deepof_single_topview/",
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"
# "--exclude-bodyparts Tail_base,Tail_1,Tail_2,Tail_tip "
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment