Cosmological parameter inference of the ΛCDM model (Ωm, σ8) combining three key components:
a neural network that learns the Fisher score function (TensorFlow/Keras), the physical emulator
CAMB for the power spectrum P(k), and MCMC for posterior Bayesian inference.
Final project for Machine Learning in Cosmology (Master's in Physics). Author: José Ake · github.com/ak3sit0 Method based on Sui et al. (2025), Fisher Score Matching.
Given a real parameter θ = (Ωm, σ8), its physical observable P(k) is generated with CAMB and a noisy version
θ* = θ + ε, ε ~ N(0, σ²). The network learns to map the spectrum to the noisy parameter,
approximating the Fisher score function that guides sampling via Langevin/MCMC toward the posterior.
The result is contrasted against a reference MCMC.
- Simulation (CAMB): synthetic dataset
(θ, θ*, P(k)). - Training: neural network (Keras) that estimates Fisher score.
- Inference: MCMC sampling guided by the network.
- Validation: comparison of posteriors (corner plots) against standard MCMC.
Dataset P(k) |
Training History | Comparative Posterior |
|---|---|---|
![]() |
![]() |
![]() |
pip install -r requirements.txt
jupyter notebook notebooks/score_matching_lcdm.ipynbThe trained model (models/modelo_score.keras) and normalizers (models/normalizers.json)
are included to reproduce inference without re-training. The data/ folder is generated when running
the simulation phase with CAMB.
cosmology-score-matching/
├── notebooks/ score_matching_lcdm.ipynb # complete pipeline
├── models/ modelo_score.keras · normalizers.json
├── figures/ results
├── report/ final report (PDF)
└── presentation/
camb · tensorflow / keras · numpy · matplotlib · seaborn · corner
Code under MIT license. © 2026 José Ake.
- Sui et al. (2025), Fisher Score Matching for Simulation-Based Inference.


