attribute
Train a single MLP and compute per-SNP Integrated Gradients attribution,
writing a PLINK-.glm-style TSV. See Concepts and methodology for what the
model and attribution step are doing, and Output formats for the output
column layout.
posthoc attribute
Usage
posthoc attribute [OPTIONS]
Options
- --pfile <pfile>
Required Prefix of PLINK2 .pgen/.pvar/.psam fileset.
- --pheno <pheno>
Required Phenotype file.
- --pheno-name <pheno_name>
Phenotype column name (default: first value column).
- --covar <covar>
Covariate file.
- --logistic
Binary phenotype (BCE loss).
- --linear
Continuous phenotype (MSE loss).
- --model <model_name>
- Options:
mlp
- --attribution <attribution_name>
- Options:
integrated_gradients
- --maf <min_maf>
Minimum minor allele frequency.
- --geno <max_missing>
Max per-variant missingness.
- --indep-pairwise <indep_pairwise>
LD pruning: WINDOW_SIZE STEP R2_THRESHOLD (requires plink2 on PATH).
Comma-separated MLP hidden layer sizes.
- --dropout <dropout>
Dropout parameter of neural network
- --epochs <max_epochs>
- --patience <patience>
- --lr <lr>
- --val-fraction <val_fraction>
- --n-steps <n_steps>
Integrated Gradients interpolation steps.
- --ig-baseline <ig_baseline>
Baseline reference input for Integrated Gradients.
- Options:
zero | mean
- --seed <seed>
- --device <device>
- --out <out_path>
Required Output .glm path.
Behavior notes
Exactly one of
--logistic/--linearmust be given.--modelcurrently only acceptsmlp;--attributioncurrently only acceptsintegrated_gradients. Both are exposed as explicit choices to keep the CLI stable if/when additional models or attribution methods are added.--hidden-dimsis a comma-separated list of integers, e.g.256,64for a two-hidden-layer MLP with 256 then 64 units.Attribution is computed only on the held-out validation split used during training (
train_result.val_idx), not the full dataset — soNin the output reflects the validation split size, and--val-fractionindirectly controls how many samples the attribution statistics are based on.--ig-baseline meanuses the per-feature mean of the validation design matrix as the Integrated Gradients reference input, instead of an all-zeros baseline. This is generally more appropriate for genotype data, where0is a meaningful allele count rather than a neutral reference.
Example
posthoc attribute \
--pfile datasets/data/processed/chr22_subset \
--pheno outputs/simulated.pheno \
--pheno-name PHENO1 \
--logistic \
--hidden-dims 256,64 \
--epochs 200 \
--patience 15 \
--n-steps 50 \
--ig-baseline mean \
--out outputs/ig_results.glm