autoencodix 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of autoencodix might be problematic. Click here for more details.
- autoencodix/__init__.py +27 -0
- autoencodix/base/.ipynb_checkpoints/_base_pipeline-checkpoint.py +1274 -0
- autoencodix/base/.ipynb_checkpoints/_base_trainer-checkpoint.py +247 -0
- autoencodix/base/__init__.py +21 -0
- autoencodix/base/_base_autoencoder.py +138 -0
- autoencodix/base/_base_dataset.py +103 -0
- autoencodix/base/_base_evaluator.py +34 -0
- autoencodix/base/_base_loss.py +311 -0
- autoencodix/base/_base_pipeline.py +1355 -0
- autoencodix/base/_base_predictor.py +6 -0
- autoencodix/base/_base_preprocessor.py +1033 -0
- autoencodix/base/_base_trainer.py +259 -0
- autoencodix/base/_base_visualizer.py +578 -0
- autoencodix/base/sampleconfig.yaml +132 -0
- autoencodix/configs/__init__.py +21 -0
- autoencodix/configs/default_config.py +652 -0
- autoencodix/configs/disentanglix_config.py +15 -0
- autoencodix/configs/maskix_config.py +39 -0
- autoencodix/configs/ontix_config.py +35 -0
- autoencodix/configs/stackix_config.py +33 -0
- autoencodix/configs/vanillix_config.py +18 -0
- autoencodix/configs/varix_config.py +15 -0
- autoencodix/configs/xmodalix_config.py +43 -0
- autoencodix/disentanglix.py +72 -0
- autoencodix/evaluate/.ipynb_checkpoints/evaluate-checkpoint.py +532 -0
- autoencodix/evaluate/__init__.py +4 -0
- autoencodix/evaluate/_general_evaluator.py +730 -0
- autoencodix/evaluate/_xmodalix_evaluator.py +376 -0
- autoencodix/imagix.py +76 -0
- autoencodix/losses/disentanglix_loss.py +215 -0
- autoencodix/losses/maskix_loss.py +94 -0
- autoencodix/losses/vanillix_loss.py +28 -0
- autoencodix/losses/varix_loss.py +102 -0
- autoencodix/losses/xmodal_loss.py +304 -0
- autoencodix/maskix.py +108 -0
- autoencodix/modeling/.ipynb_checkpoints/__init__-checkpoint.py +16 -0
- autoencodix/modeling/.ipynb_checkpoints/_captum_forward-checkpoint.py +16 -0
- autoencodix/modeling/__init__.py +20 -0
- autoencodix/modeling/_captum_forward.py +20 -0
- autoencodix/modeling/_classifier.py +45 -0
- autoencodix/modeling/_imagevae_architecture.py +296 -0
- autoencodix/modeling/_imgfast_architecture.py +288 -0
- autoencodix/modeling/_layer_factory.py +71 -0
- autoencodix/modeling/_maskix_architecture.py +190 -0
- autoencodix/modeling/_ontix_architecture.py +305 -0
- autoencodix/modeling/_vanillix_architecture.py +136 -0
- autoencodix/modeling/_varix_architecture.py +192 -0
- autoencodix/notebooks/__init__.py +0 -0
- autoencodix/ontix.py +136 -0
- autoencodix/py.typed +0 -0
- autoencodix/stackix.py +122 -0
- autoencodix/trainers/__init__.py +6 -0
- autoencodix/trainers/_general_trainer.py +525 -0
- autoencodix/trainers/_maskix_trainer.py +116 -0
- autoencodix/trainers/_ontix_trainer.py +77 -0
- autoencodix/trainers/_stackix_orchestrator.py +522 -0
- autoencodix/trainers/_stackix_trainer.py +209 -0
- autoencodix/trainers/_xmodal_trainer.py +1006 -0
- autoencodix/utils/.ipynb_checkpoints/_explainer-checkpoint.py +118 -0
- autoencodix/utils/.ipynb_checkpoints/_model_output-checkpoint.py +30 -0
- autoencodix/utils/.ipynb_checkpoints/_utils-checkpoint.py +626 -0
- autoencodix/utils/.ipynb_checkpoints/adata_converter-checkpoint.py +99 -0
- autoencodix/utils/.ipynb_checkpoints/feature_importance-checkpoint.py +823 -0
- autoencodix/utils/__init__.py +22 -0
- autoencodix/utils/_annealer.py +193 -0
- autoencodix/utils/_bulkreader.py +232 -0
- autoencodix/utils/_explainer.py +246 -0
- autoencodix/utils/_imgreader.py +404 -0
- autoencodix/utils/_internals.py +23 -0
- autoencodix/utils/_llm_explainer.py +318 -0
- autoencodix/utils/_losses.py +20 -0
- autoencodix/utils/_model_output.py +30 -0
- autoencodix/utils/_result.py +393 -0
- autoencodix/utils/_screader.py +76 -0
- autoencodix/utils/_traindynamics.py +187 -0
- autoencodix/utils/_utils.py +690 -0
- autoencodix/utils/adata_converter.py +111 -0
- autoencodix/utils/example_data.py +398 -0
- autoencodix/utils/feature_importance.py +829 -0
- autoencodix/utils/prompts.py +21 -0
- autoencodix/vanillix.py +141 -0
- autoencodix/varix.py +80 -0
- autoencodix/visualize/__init__.py +5 -0
- autoencodix/visualize/_general_visualizer.py +913 -0
- autoencodix/visualize/_imagix_visualizer.py +111 -0
- autoencodix/visualize/_xmodal_visualizer.py +841 -0
- autoencodix/visualize/visualize.py +1214 -0
- autoencodix/xmodalix.py +318 -0
- autoencodix-0.2.0.dist-info/METADATA +143 -0
- autoencodix-0.2.0.dist-info/RECORD +91 -0
- autoencodix-0.2.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# DATA DEFINITIONS ------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
K_FILTER: 1000 # SHOULDDO Number of features after filtering per data modality
|
|
4
|
+
|
|
5
|
+
## Model and Training --------------------------------------------------------
|
|
6
|
+
# ----------------------------------------------------------------------------
|
|
7
|
+
TRAIN_TYPE: "train" # SHOULDDO train or tune are possible
|
|
8
|
+
MODEL_TYPE: "varix" #SHOULDO which autoencoder to use: vanillix, varix, stackix, ontix or x-modalix
|
|
9
|
+
BETA: 0.1 # OPTIONAL float that adds a weight to the KL divergence or MMD loss of variational autoencoder
|
|
10
|
+
|
|
11
|
+
LATENT_DIM_FIXED: 2 # SHOULDDO number of neurons in latent dimenion (all integer values are possible)
|
|
12
|
+
BATCH_SIZE: 512 # SHOULDDO (all integer values are possible, depending on your hardware and data size)
|
|
13
|
+
EPOCHS: 100 # SHOULDDO (all integer values are possible)
|
|
14
|
+
LR_FIXED: 0.0005 # SHOULDDO Learning Rate for training (all float values are possible)
|
|
15
|
+
VAE_LOSS: "KL" # SHOULDDO loss function for VAE to fit standard normal distribution (KL or MMD)
|
|
16
|
+
RECONSTR_LOSS: "MSE" # SHOULDDO (BCE or MSE)
|
|
17
|
+
|
|
18
|
+
PREDICT_SPLIT: "all" # SHOULDDO data split the trainied model uses to generate latent space (all, train, test, valid are possible) default is all
|
|
19
|
+
|
|
20
|
+
# # Ontix specific
|
|
21
|
+
NON_ONT_LAYER: 1 # OPTIONAL Specify additional layer for ontix if should LATENT_DIM_FIXED < Ontology Dimension
|
|
22
|
+
FILE_ONT_LVL1: "full_ont_lvl1_reactome.txt" # OPTIONAL Mandotory for ontix; LVL1 specifies relationship of features and first ontology level in sparse decoder
|
|
23
|
+
FILE_ONT_LVL2: "full_ont_lvl2_reactome.txt" # OPTIONAL for ontix; LVL2 specifies relationship of first ontology level and a second level (dim(lvl1) > dim(lvl2)) in sparse decoder
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
# # X-modalix specific
|
|
27
|
+
TRANSLATE: "KLIMBIM_to_ANDERERKLIMBIM" # TODO, TRAIN_TYPE=translate, when <FROMDATA>_to_<TODATA>
|
|
28
|
+
GAMMA: 5 # OPTIONAL weighs the latent space classifier loss for th translation case
|
|
29
|
+
DELTA_PAIR: 5 # OPTIONAL weigths for pairing loss term (xmodalix)
|
|
30
|
+
DELTA_CLASS: 5 # OPTIONAL weigths for class/supervision loss term (xmodalix)
|
|
31
|
+
PRETRAIN_TARGET_MODALITY: null #SHOULDDO For `x-modalix` VAE's can be pretrained before latent spaces will be aligned. Options are pretrain_image or gamma_anneal or null to switch off pretraining.
|
|
32
|
+
ANNEAL_PRETRAINING: False #OPTIONAL (True or False) indicates if beta annealing should be used in pretraining target modality or while using gamma annealing in pretraining
|
|
33
|
+
PRETRAIN_EPOCHS: 100 #OPTIONAL (all integer values are possible) number of epochs of gamma_anneal or pretrain_image (additional to EPOCHS) (set 0 if not wanted)
|
|
34
|
+
CLASS_PARAM: "CANCER_TYPE_ACRONYM" #OPTIONAL Annotation parameter (str) to which the latent space is aligned for the MODEL_TYPE "x-modalix" and is a column as defined in the Annotation DATA_TYPE. Set to null if not wanted.
|
|
35
|
+
|
|
36
|
+
# OPTUNA TUNING VARS-----------------------------------------------------------
|
|
37
|
+
# -----------------------------------------------------------------------------
|
|
38
|
+
LAYERS_LOWER_LIMIT: 2 # OPTIONAL minumum number of layers for hyperparamter tuning(all integer values are possible)
|
|
39
|
+
LAYERS_UPPER_LIMIT: 5 # OPTIONAL maximum number of layers for hyperparamter tuning(all integer values are possible)
|
|
40
|
+
LR_LOWER_LIMIT: 0.0001 # OPTIONAL minimum learning rate for hyperparamter tuning(all float values are possible)
|
|
41
|
+
LR_UPPER_LIMIT: 0.05 # OPTIONAL maximum learning rate for hyperparamter tuning(all float values are possible)
|
|
42
|
+
DROPOUT_LOWER_LIMIT: 0.00 # OPTIONAL minimum dropout rate for hyperparamter tuning(all float values are possible)
|
|
43
|
+
DROPOUT_UPPER_LIMIT: 0.50 # OPTIONAL maximum dropout rate for hyperparamter tuning(all float values are possible)
|
|
44
|
+
OPTUNA_TRIALS: 40 # OPTIONAL number of trials for hyperparamter tuning(all integer values are possible)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
# EVALUATION and VISUALIZATION ------------------------------------------------
|
|
48
|
+
# -----------------------------------------------------------------------------
|
|
49
|
+
DIM_RED_METH: "UMAP" # OPTIPNAL PCA or UMAP or TSNE
|
|
50
|
+
CLUSTER_ALG: "KMeans" # OPTIONAL KMeans or HDBScan
|
|
51
|
+
CLUSTER_N: 32 # OPTIONAL Number of clusters for KMeans
|
|
52
|
+
MIN_CLUSTER_N: 20 # OPTIONAL Minimal number of samples per cluster as crucial parameter for HDBSCAN
|
|
53
|
+
CLINIC_PARAM: # TODO needs to be a column name of the ANNOTATION data
|
|
54
|
+
- "CANCER_TYPE_ACRONYM" # Feature to be visualized on latent space plot and used for learning alling of downstream machine learning task
|
|
55
|
+
- "TMB_NONSYNONYMOUS"
|
|
56
|
+
ML_TYPE: "Auto-detect" # TODO For the given CLINIC_PARAM either regression or classification ML tasks will be performed. If auto-detect, non-string parameters will be assumed to be regression tasks.
|
|
57
|
+
# CANCER_TYPE: "classification" # OPTIONAL classification or regression
|
|
58
|
+
# TMB_NONSYNONYMOUS: "regression" # OPTIONAL classification or regression
|
|
59
|
+
ML_ALG: # OPTIONAL which machine learning algorithms should be used for evaluation, Linear, RF, SVM are possible
|
|
60
|
+
- Linear
|
|
61
|
+
- RF
|
|
62
|
+
- SVM
|
|
63
|
+
ML_SPLIT: "use-split" # OPTIONAL "use-split" or "CV-on-all-data"
|
|
64
|
+
ML_TASKS: # OPTIONAL which dimension reduction methods should be used for the ml task, Latent, UMAP, PCA, RandomFeature are possible
|
|
65
|
+
- Latent
|
|
66
|
+
- UMAP
|
|
67
|
+
- PCA
|
|
68
|
+
- RandomFeature
|
|
69
|
+
|
|
70
|
+
LOGLEVEL: "INFO" # OPTIONAL (DEBUG, INFO, WARNING, ERROR)
|
|
71
|
+
|
|
72
|
+
# Data Specification ---------------------------------------------------------
|
|
73
|
+
# ----------------------------------------------------------------------------
|
|
74
|
+
ROOT_RAW: "data/raw" # This variable specifies the root directory path for raw data.
|
|
75
|
+
ROOT_IMAGE: "data/fakedata/tcga_fake" # This variable specifies the root directory path for raw images data.
|
|
76
|
+
DELIM: "\t" # This variable specifies the delimiter character used in input and output data files. Input files need to have file extension csv, tsv or txt.
|
|
77
|
+
SPLIT: [0.7, 0.1, 0.2] # OPTIONAL Train, Validate, Test or "pre-computed"
|
|
78
|
+
SPLIT_FILE: "data/processed/sample_split.parquet" # This variable specifies the path to the file containing the generated (use always default path) or pre-computed data split. If you want to give a specific train/test/valid split then you need to provide a file with the sample ID and a column that indicates to which split the sample belongs (train, test, valid). To activate pre-computed split, you must set config option SPLIT to "pre-computed".
|
|
79
|
+
|
|
80
|
+
FORM_SUFFIX: "_formatted.parquet" # This variable specifies a suffix for the formatted data files when running join_format_tcga or format_singlecell
|
|
81
|
+
|
|
82
|
+
# Single-Cell Specification --------------------------------------------------
|
|
83
|
+
# ----------------------------------------------------------------------------
|
|
84
|
+
|
|
85
|
+
MIN_GENE: 0.06 # Controls filtering of sparse samples (cells) with less then MIN_GENE percent expressed genes of total gene using scanpy filter_cells
|
|
86
|
+
MIN_PERC_CELLS: 0.1 # Keep only genes in single-cell data which are present in at least x fraction of all cells using filter scanpy filter_genes. Filtering is done after sample filtering.
|
|
87
|
+
K_FILTER_SC: 6000 # After filtering for sparse samples and sparse genes the K_FILTER_SC genes with the highes variables are selected using scanpy highly_variable_genes. Should be higher than K_FILTER in the run config.
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
# Model and Training Specification -------------------------------------------
|
|
92
|
+
# ----------------------------------------------------------------------------
|
|
93
|
+
START_FROM_LAST_CHECKPOINT: false # This variable specifies whether to start training from the last checkpoint. Useful when machine or server crashed during training. Recommended to restart training with make model_only.
|
|
94
|
+
WEIGHT_DECAY: 0.001 # This variables specifies the hyperparameter weight decay for training with solver (AdamW).
|
|
95
|
+
DROP_P: 0.1 # Probability of drop out in drop out layer in all autoencoder architectures with drop out.
|
|
96
|
+
ANNEAL: "logistic-mid" # This variables controls the beta-annealing (VAE-loss) of the training of all variational autoencoders. Options are logistic-early, logistic-mid, logistic-late, 3phase-linear,3phase-log or no-annealing
|
|
97
|
+
ANNEAL_PRETRAINING: False #OPTIONAL (True or False) indicates if beta annealing should be used in pretraining target modality or while using gamma annealing in pretraining
|
|
98
|
+
PRUN_PATIENCE: 0.05 # This variables controls the pruning of runs during hyperparameter tuning with optuna. "0" is full pruning (no patience) and stops trials early. "1" leads to no pruning at all since all epochs are considered. Pruning is disabled when beta-annealing is active.
|
|
99
|
+
WEIGHT_DECAY_LOWER_LIMIT: 0.00001 # OPTIONAL lower limit for weight decay in hyperparameter tuning with optuna
|
|
100
|
+
WEIGHT_DECAY_UPPER_LIMIT: 0.1 # OPTIONAL upper limit for weight decay in hyperparameter tuning with optuna
|
|
101
|
+
ENCODING_FACTOR_LOWER_LIMIT: 1 # OPTIONAL lower limit for encoding factor in hyperparameter tuning with optuna
|
|
102
|
+
ENCODING_FACTOR_UPPER_LIMIT: 64 # OPTIONAL upper limit for encoding factor in hyperparameter tuning with optuna
|
|
103
|
+
TUNE_N_FILTERS: True # OPTIONAL (True or False) indicates if the number of filters should be tuned in hyperparameter tuning with optuna
|
|
104
|
+
LOSS_REDUCTION: "sum" #OPTIONAL (sum or mean) indicates if the loss should be summed or averaged over all features in the loss function
|
|
105
|
+
|
|
106
|
+
FIX_RANDOMNESS: "random" # "random" for no fixing, "all" fix all randomness, "data_split" fix train/test/valid split, "training" fix weight initialization and randomness in training; not available for tuning with optuna
|
|
107
|
+
GLOBAL_SEED: 42 # Seed used to fix randomness.
|
|
108
|
+
|
|
109
|
+
KEEP_NOT_ONT: false # If feature is not part of the provided ontology, a new ontology for those features will created and features will not be dropped
|
|
110
|
+
|
|
111
|
+
NORMALIZE_RECONS_LOSS_XMODALIX: true # Should the reconstruction loss terms for each data modality which are translated by x-modalix be normalized by their respective feature size?
|
|
112
|
+
|
|
113
|
+
CHECKPT_SAVE: false # Should intermediate models in training be saved in models folder at checkpoint epochs? Not available for x-modalix
|
|
114
|
+
RECON_SAVE: false # Should the reconstructed values of input features (x) be saved under reports?
|
|
115
|
+
|
|
116
|
+
# visualize control --------------------------------------------------------
|
|
117
|
+
# ---------------------------------------------------------------------------
|
|
118
|
+
CHECKPT_PLOT: false # Should the latent space be plotted at checkpoint epochs? Not available for x-modalix
|
|
119
|
+
PLOT_INPUT2D: false # Should a direct embedding of inputlayer performed (using DIM_RED_METH) and be plotted for comparison to autoencoder?
|
|
120
|
+
PLOT_WEIGHTS: false # Should the initial and trained weights be plotted as heatmaps
|
|
121
|
+
PLOT_CLUSTLATENT: false # Should latent space be clustered and be visualized
|
|
122
|
+
PLOT_NUMERIC: false # Should numeric parameters in CLIN_PARAM be plotted as continuous (true) or as categories/percentiles (false, default)
|
|
123
|
+
|
|
124
|
+
# ml_task control --------------------------------------------------------
|
|
125
|
+
# ---------------------------------------------------------------------------
|
|
126
|
+
CV: 5 # This variable specifies the the number of cross-validation rounds (only if ML_SPLIT: "CV-on-all-data")
|
|
127
|
+
|
|
128
|
+
# Test Synth Signal Specification -------------------------------------------
|
|
129
|
+
# ---------------------------------------------------------------------------
|
|
130
|
+
APPLY_SIGNAL: false # For testing a synthetic signal can be applied to the provided features and samples (see below). Synthetic signal is defined as setting the value of the features to 90% of the maximum feature value.
|
|
131
|
+
SAMPLE_SIGNAL: "data/raw/female_scCells.txt" # Path to file file with list of samples to which signal should be applied. One row per sample. No header.
|
|
132
|
+
FEATURE_SIGNAL: "data/raw/chrX_ensemblID.txt" # Path to file file with list of features to which signal should be applied. One row per feature. No header.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from .default_config import DataCase, DefaultConfig, DataInfo
|
|
2
|
+
from .ontix_config import OntixConfig
|
|
3
|
+
from .disentanglix_config import DisentanglixConfig
|
|
4
|
+
from .stackix_config import StackixConfig
|
|
5
|
+
from .vanillix_config import VanillixConfig
|
|
6
|
+
from .varix_config import VarixConfig
|
|
7
|
+
from .xmodalix_config import XModalixConfig
|
|
8
|
+
from .maskix_config import MaskixConfig
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"DataCase",
|
|
12
|
+
"DefaultConfig",
|
|
13
|
+
"DataInfo",
|
|
14
|
+
"OntixConfig",
|
|
15
|
+
"DisentanglixConfig",
|
|
16
|
+
"StackixConfig",
|
|
17
|
+
"VanillixConfig",
|
|
18
|
+
"VarixConfig",
|
|
19
|
+
"XModalixConfig",
|
|
20
|
+
"MaskixConfig",
|
|
21
|
+
]
|