Research · Cognitive Neuroscience · MAMME TFM

Softmax GLM-HMM
built on Dynamax

glmhmmt is a Python package for fitting Hidden Markov Models with Generalised Linear Model emissions to behavioural data — designed for cognitive neuroscience research at IDIBAPS.

scroll

Why glmhmmt

Built for real experimental data

Wraps the ergonomic Dynamax API and adds per-subject session-aware EM, feature engineering helpers, and rich matplotlib diagnostics.

Session-aware EM
Handles multiple independent sessions per subject correctly during the Expectation–Maximisation fitting loop.
JAX-accelerated
Pure JAX backend via Dynamax — JIT compilation and GPU/TPU ready out of the box, no boilerplate.
Rich diagnostics
State occupancy, transition matrices, emission weight heatmaps and per-subject posterior visualisations included.
Feature helpers
build_sequence_from_df transforms raw trial DataFrames into the exact tensor format the model expects.
Postprocessing built-in
Extract trial-level state assignments, emission weight tables and posterior distributions with one-liner helper functions.
SBI compatible
Designed to pair with Simulation-Based Inference workflows for model recovery and posterior validation experiments.

Installation

Get up and running in seconds

# clone & install in editable mode
git clone https://github.com/javirm3/TFM
cd TFM/code/glmhmmt
pip install -e .

# then in Python
from glmhmmt import SoftmaxGLMHMM
Coming soon to PyPI for a direct pip install glmhmmt experience.
View quickstart guide →