Skip to main content

Kernel Stein Discrepancy descent

Project description

GHActions PyPI

Sampling by optimization of the Kernel Stein Discrepancy

The paper is available at arxiv.org/abs/2105.09994.

The code uses Pytorch, and a numpy backend is available for svgd.

ksd_picture

Install

The code is available on pip:

$ pip install ksddescent

Documentation

The documentation is at pierreablin.github.io/ksddescent/.

Example

The main function is ksdd_lbfgs, which uses the fast L-BFGS algorithm to converge quickly. It takes as input the initial position of the particles, and the score function. For instance, to samples from a Gaussian (where the score is identity), you can use these simple lines of code:

>>> import torch
>>> from ksddescent import ksdd_lbfgs
>>> n, p = 50, 2
>>> x0 = torch.rand(n, p)  # start from uniform distribution
>>> score = lambda x: x  # simple score function
>>> x = ksdd_lbfgs(x0, score)  # run the algorithm

Reference

If you use this code in your project, please cite:

Anna Korba, Pierre-Cyril Aubin-Frankowski, Simon Majewski, Pierre Ablin
Kernel Stein Discrepancy Descent
International Conference on Machine Learning, 2021

Bug reports

Use the github issue tracker to report bugs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ksddescent-0.3.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

ksddescent-0.3-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file ksddescent-0.3.tar.gz.

File metadata

  • Download URL: ksddescent-0.3.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0.post20200714 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.7

File hashes

Hashes for ksddescent-0.3.tar.gz
Algorithm Hash digest
SHA256 8104173b61049244aa6649e6f2970398c8d5aabc3b70a4d1ce8f4de9955a771f
MD5 85eba9189349f185550c55b5043f7d6a
BLAKE2b-256 76720a9bf5e7ceae33c77e09c51f72d6bb9be9bb8ef6cdc381f08da82ac576ab

See more details on using hashes here.

File details

Details for the file ksddescent-0.3-py3-none-any.whl.

File metadata

  • Download URL: ksddescent-0.3-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0.post20200714 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.7

File hashes

Hashes for ksddescent-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 093e32135cb48f2b711d4d4c407738d47bf93b050204054a126e7176b7404c31
MD5 11831d593dd1bec8fdca46da28790205
BLAKE2b-256 8d6fd96f19bbaae7e7a89c7a66e4192bce38d43f783570a4b76ee537ef4381fa

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page