Download lan/ddm_normal_st/README.md from franklab/HSSM: direct link, hf CLI and curl.
- Browser
- Download file 6.26 kB
-
https://huggingface.co/franklab/HSSM/resolve/main/lan/ddm_normal_st/README.md
- Command line
-
hf download hf://franklab/HSSM/lan/ddm_normal_st/README.md
-
curl -L -o README.md https://huggingface.co/franklab/HSSM/resolve/main/lan/ddm_normal_st/README.md
tags:
- lan
- ssm
- hssm
- ddm
- non-decision-time-variability
library_name: onnx
license: bsd-2-clause
ddm_normal_st (LAN)
Likelihood approximation network for the ddm_normal_st sequential sampling model: the standard drift diffusion model -- drift v, boundary separation a, relative starting point z -- with trial-to-trial variability in non-decision time. Each trial's non-decision time is drawn from an untruncated Normal(t, st), so st is the standard deviation of the kernel. A Normal SD of s has the same variance as a uniform half-width of sqrt(3) times s, about 1.7 s, so st values are not interchangeable with ddm_st's. Parameters are v, a, z, t, st, in that order. The training box is the same as ddm_st's: v (-3, 3), a (0.3, 2.5), z (0.3, 0.7), t (0.25, 2.25), st (0.001, 0.35), with no st <= t constraint. KDE training labels are fit on positive response times only. Trained for 20 epochs with Adam under a warm-up cosine learning-rate schedule (1e-5 rising to a peak of 1e-3 over the first epoch, then decaying to 0); the training config also records a reduce-on-plateau scheduler, which the JAX trainer does not use.
Recovery verdict: PASS. Judged alone on a 240-fit sweep (12 design cells x 20 datasets: single-condition designs and designs that vary v, a or st across conditions, each at 250, 500 and 1000 trials; 81 family-corrected tests) this network records zero coverage failures, zero bias failures, and zero cells the design could not identify, with 97.6% of parameter records converged (r-hat <= 1.01, bulk ESS >= 400). Per-cell coverage of the 94% interval ranges v 0.83-1.00, a 0.89-1.00, z 0.80-0.95, t 0.89-1.00, st 0.79-1.00, with a mean of 0.932 over all 81 cells; z is the lowest at a cell mean of 0.89. See recovery_report.json in this folder for the full per-cell table.
The sweep has no exact-likelihood arm, but a separate single-subject test supplies the ceiling: 1,000 datasets at each of 1,024 and 4,096 trials, drawn over the Fengler et al. (2021) benchmark ranges with sv = sz = 0, fit with this network under a flat prior over the training box, with the exact likelihood importance-sampled from the network's posterior on the same datasets. On the roughly 500 and 430 datasets that survive the convergence and minority-choice filters at the two trial counts, the network is below that ceiling on st, and the gap grows with trials: st covers 0.88 against 0.93 exact at 1,024 trials and 0.74 against 0.91 at 4,096. Coverage of the 94% interval at 4,096 trials:
parameter v a z t st network 0.90 0.91 0.86 0.86 0.74 exact 0.93 0.58 0.93 0.93 0.91
The st shortfall is largest when true st is small. Coverage of st at 4,096 trials by true st:
true st 0.05-0.08 0.08-0.11 0.11-0.14 0.14-0.17 0.17-0.20 network 0.69 0.69 0.74 0.85 0.73 exact 0.91 0.90 0.94 0.96 0.83
The shortfall is also larger when true t is above the lower third of its range. The network's posteriors are as wide as the exact ones (width ratio 1.03) but sit in the wrong place: for true st between 0.05 and 0.11 the posterior mean is about 15% low. That offset does not shrink with data. It is 0.4 exact standard deviations at 1,024 trials and 0.8 at 4,096, so the interval misses more often as trials grow. This is a known property of these approximations; expect st intervals to be too narrow above a few thousand trials per estimated quantity. The exact arm's low coverage of a is the continuous likelihood judged against a simulator with a 1 ms time step, not the network.
Density: the worst Hellinger distance to a 20k-trial simulation is 0.058, and on every checked draw the distance is BELOW the Monte Carlo sampling floor at that sample size (worst ratio 0.82 against a gate bar of 3.0). Total probability mass stays within 0.3% of 1.0 on every draw. The ONNX file reproduces the trained network's forward pass to 6.7e-6 in log-likelihood.
Caveats. Fit lapse-free data with p_outlier=None: the training data contain no lapses and the recovery sweep fit with p_outlier=None. HSSM's non-decision-time guard must be the st-aware one (HSSM #1292) with this model's edge policy, which floors each trial at t - 3st (HSSM #1345). The Normal kernel has no lower edge, and a floor at t - st stalls the sampler (r-hat 3.4, ESS 4, against r-hat 1.01, ESS 697 at t - 3st). Because the box allows st > t and the kernel is unbounded, data simulated in that corner can contain non-positive response times (about 16% of trials at t 0.25, st 0.35, a 0.3). HSSM checks the declared bounds against the installed ssm-simulators, so this network needs an ssm-simulators release that declares st up to 0.35 (the first release after ssm-simulators #390). Hierarchical checks at true st 0.30 read 0.02-0.035 high for this and every sibling architecture while still covering it; expect a mild pull toward the top of the box.
Architecture
- Network Type: lan
- Layer Sizes: [100, 100, 100, 1]
- Activations: ['tanh', 'tanh', 'tanh', 'linear']
Training
- Epochs: 20
- Optimizer: adam
- Learning Rate: 0.001
- Loss: huber
Usage with HSSM
import hssm
# TODO: name the first HSSM release that ships the ddm_normal_st config with
# st up to 0.35 and the t - 3*st edge policy, and requires the
# ssm-simulators release that declares st up to 0.35.
#
# p_outlier=None is deliberate. HSSM attaches a 5% lapse by default, but the
# training data contains no lapses, so the default misspecifies every fit --
# the bias stays fixed while the posterior sd shrinks as 1/sqrt(n), so
# coverage gets WORSE as the dataset grows. Set a lapse only if your data
# has one.
model = hssm.HSSM(data=data, model="ddm_normal_st", p_outlier=None)
# Parameter order is v, a, z, t, st. It is the ONNX input column order, and
# a wrong order does not raise -- it evaluates the wrong likelihood.
# Do not pass this network to an HSSM release without the st-aware guard
# and its t - 3*st edge policy: a floor at t - st stalls the sampler.
Citation
If you use this model, please cite: