Kdm
Kernel Density Matrices Python library
Install / Use
/learn @fagonzalezo/KdmREADME
Kernel Density Matrices
Kernel Density Matrices (KDMs) are a generalization of density matrices used in quantum mechanics to represent the probabilistic state of a quantum system. KDMs provide a simpler yet effective mechanism for representing joint probability distributions of both continuous and discrete random variables. The framework allows for the construction of differentiable models for density estimation, inference, and sampling, enabling integration into end-to-end deep neural models.
Getting Started
You can install the most recent version of the library with
pip install git+https://github.com/fagonzalezo/kdm.git
Memory based models require additionally the installation of the faiss library. You can install it with
pip install faiss-cpu
Check our examples to see what you can do!
Paper
Kernel Density Matrices for Probabilistic Deep Learning
Fabio A. González, Raúl Ramos-Pollán, Joseph A. Gallego-Mejia
https://doi.org/10.1007/s42484-025-00299-9
<p align="justify"><b>Abstract:</b> <i>This paper introduces a novel approach to probabilistic deep learning, kernel density matrices, which provide a simpler yet effective mechanism for representing joint probability distributions of both continuous and discrete random variables. In quantum mechanics, a density matrix is the most general way to describe the state of a quantum system. This work extends the concept of density matrices by allowing them to be defined in a reproducing kernel Hilbert space. This abstraction allows the construction of differentiable models for density estimation, inference, and sampling, and enables their integration into end-to-end deep neural models. In doing so, we provide a versatile representation of marginal and joint probability distributions that allows us to develop a differentiable, compositional, and reversible inference procedure that covers a wide range of machine learning tasks, including density estimation, discriminative learning, and generative modeling. The broad applicability of the framework is illustrated by two examples: an image classification model that can be naturally transformed into a conditional generative model, and a model for learning with label proportions that demonstrates the framework's ability to deal with uncertainty in the training samples.</i></p>
Citation
If you find this code useful in your research, please consider citing:
@article{gonzalez2025kernel,
title={Kernel density matrices for probabilistic deep learning},
author={Gonz{\'a}lez, Fabio A and Ramos-Poll{\'a}n, Ra{\'u}l and Gallego, Joseph},
journal={Quantum Machine Intelligence},
volume={7},
number={2},
pages={94},
year={2025},
publisher={Springer}
}
Related Skills
node-connect
344.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
96.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
