Code repository for the paper:
R. Tresor, M. Hidalgo Araya, W. Nuijten, T. van de Laar, B. de Vries. "Situated Hearing Aid Personalization as Bayesian Inference," 2026.
This repository implements the validation experiments described in the paper. A Bayesian hearing-aid agent learns user preferences through an online scanning interaction protocol, using variational message passing on Forney-style factor graphs for both preference inference and active trial design.
Two simulation experiments are provided:
- Inference performance (Section 5.1) -- evaluates the agent under model-matched conditions across a full factorial parameter sweep.
- Hearing-aid personalization (Section 5.2) -- evaluates the agent in a realistic HA tuning scenario using PESQ as a surrogate for user-perceived quality.
.
├── src/
│ └── common.jl # Shared type definitions and utilities
├── experiment/
│ ├── inference_performance.jl # Experiment 1: inference performance (Sec. 5.1)
│ ├── hearing_aid_personalization.jl # Experiment 2: HA personalization (Sec. 5.2)
│ └── data_generation.jl # Synthetic data generation demo
├── environment/
│ ├── environment.jl # RxEnvironments interaction logic (Exp. 1)
│ ├── user.jl # Simulated user model (HAUser)
│ └── agent.jl # (Consolidated into src/common.jl)
├── model/
│ └── happiness_tracking.jl # Generative model: RxInfer @model definitions
├── nodes/
│ ├── extended_probit.jl # Custom ExtendedProbit factor node
│ └── projection_scheme.jl # Projection scheme for message passing
├── sound_processing/
│ ├── world.jl # RxEnvironments world for audio experiment (Exp. 2)
│ ├── hearingaid.jl # Warped filterbank hearing aid model
│ └── pnr.jl # Power-based noise reduction algorithm
├── metrics/
│ └── metrics.jl # PESQ and STOI speech quality metrics (via PyCall)
├── data/
│ ├── clean.wav # Clean speech reference (VoiceBank corpus)
│ ├── noisy.wav # Noisy speech signal (VoiceBank corpus)
│ └── README.md # Data provenance and citation
├── results/ # Pre-computed experiment results (CSV)
├── showcase.ipynb # Analysis and visualization notebook
├── Project.toml # Julia dependency specification
└── requirements.txt # Python dependency specification
- Julia 1.10+ (tested with 1.10.10)
- Python 3.9+ with packages listed in
requirements.txt(only needed for Experiment 2)
using Pkg
Pkg.activate(".")
Pkg.instantiate()pip install -r requirements.txtIf Julia's PyCall does not find the correct Python environment:
ENV["PYTHON"] = "/path/to/your/python"
using Pkg; Pkg.build("PyCall")julia --project=. experiment/inference_performance.jlProduces: results/experiment_results_2_scannings.csv
Paper mapping: Table 1 -- RRMSD, RMSD_post, and variance ratio metrics across parameter sweep (6,300 runs).
Note: The sleep(1) calls in the experiment loop add significant wall-clock time to batch runs. These can be commented out without affecting results.
julia --project=. experiment/hearing_aid_personalization.jlProduces: results/experiment_results_audio.csv
Paper mapping: Table 2 -- RRMSD of inferred G_min from oracle optimum; Figure 7 -- scanning trajectories and posterior evolution.
The showcase.ipynb notebook loads the result CSVs and generates the tables and figures reported in the paper. To run it:
using Pkg; Pkg.add("IJulia")
using IJulia; notebook()| Script | Paper Section | Output |
|---|---|---|
experiment/inference_performance.jl |
Sec. 5.1 | Table 1 (RRMSD, RMSD, Var. ratio) |
experiment/hearing_aid_personalization.jl |
Sec. 5.2 | Table 2 + Figure 7 |
experiment/data_generation.jl |
Sec. 4 (model demo) | Synthetic data |
showcase.ipynb |
Sec. 5.1 & 5.2 | All tables and figures |
Audio files in data/ are excerpts from the VoiceBank corpus:
Valentini-Botinhao, C. (2017). Noisy Speech Database for Training Speech Enhancement Algorithms and TTS Models. University of Edinburgh. DOI: 10.7488/ds/2117
See data/README.md for details.
- RxInfer.jl -- Bayesian inference via variational message passing
- RxEnvironments.jl -- Reactive environment framework for agent-based simulation
@article{tresor2025situated,
title = {Situated Hearing Aid Personalization as Bayesian Inference},
author = {Tresor, Raphael and Hidalgo Araya, Marco and Nuijten, Wouter
and van de Laar, Thijs and de Vries, Bert},
year = {2025}
}