Skip to content

ak3sit0/cosmology-score-matching

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fisher Score Matching for ΛCDM Neural Network-Assisted

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.


Idea

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.

Pipeline

  1. Simulation (CAMB): synthetic dataset (θ, θ*, P(k)).
  2. Training: neural network (Keras) that estimates Fisher score.
  3. Inference: MCMC sampling guided by the network.
  4. Validation: comparison of posteriors (corner plots) against standard MCMC.

Results

Dataset P(k) Training History Comparative Posterior
P(k) Dataset Training History Corner Plot

Reproduce

pip install -r requirements.txt
jupyter notebook notebooks/score_matching_lcdm.ipynb

The 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.

Structure

cosmology-score-matching/
├── notebooks/   score_matching_lcdm.ipynb   # complete pipeline
├── models/      modelo_score.keras · normalizers.json
├── figures/     results
├── report/      final report (PDF)
└── presentation/

Stack

camb · tensorflow / keras · numpy · matplotlib · seaborn · corner

License

Code under MIT license. © 2026 José Ake.

Reference

  • Sui et al. (2025), Fisher Score Matching for Simulation-Based Inference.

About

Fisher Score Matching for ΛCDM cosmological parameter inference. Neural networks + CAMB + MCMC for Bayesian inference.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors