{"id":20225302,"url":"https://github.com/janhuenermann/svgd","last_synced_at":"2026-05-30T21:31:59.495Z","repository":{"id":98182432,"uuid":"182526336","full_name":"janhuenermann/svgd","owner":"janhuenermann","description":"Implementation of Stein Variational Gradient Descent to learn neural samplers.","archived":false,"fork":false,"pushed_at":"2019-04-21T12:28:20.000Z","size":793,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-13T23:27:12.548Z","etag":null,"topics":["ebm","ml"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/janhuenermann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-21T11:48:54.000Z","updated_at":"2021-01-11T05:17:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"7517216e-73fa-4340-bd8a-426d3e0a9f55","html_url":"https://github.com/janhuenermann/svgd","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janhuenermann%2Fsvgd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janhuenermann%2Fsvgd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janhuenermann%2Fsvgd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janhuenermann%2Fsvgd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/janhuenermann","download_url":"https://codeload.github.com/janhuenermann/svgd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241670090,"owners_count":20000325,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ebm","ml"],"created_at":"2024-11-14T07:12:13.397Z","updated_at":"2026-05-30T21:31:59.490Z","avatar_url":"https://github.com/janhuenermann.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Implementation of Stein Variational Gradient Descent\n\nThe paper titled _Stein Variational Gradient Descent: A General\nPurpose Bayesian Inference Algorithm_ ([link](https://arxiv.org/pdf/1608.04471)) describes how one can get samples from arbitrary distributions using a special kind of gradient descent.\n\nIn this implementation I created a _neural sampler_ that – using SVGD – learns to sample from a \ngiven (unnormalized) log probability function, which could also be an energy function. This is also described by follow-up paper _Learning to Draw Samples with Amortized Stein Variational Gradient Descent_ ([link](https://arxiv.org/pdf/1707.06626)).\n\n\u003cfigure\u003e\n\u003cimg src=\"anim.gif\" style=\"width: 100%; max-width=480px\"\u003e\n\u003cfigcaption\u003eFigure 1: Convergence of a neural network learning to sample from a gaussian mixture model. Background is the likelihood of the mixture model. \u003c/figcaption\u003e\n\u003c/figure\u003e\n\n### Applications\nSVGD is useful in the context of energy-based models; where one can learn the energy function (like a GAN) to distinguish\nbetween generated samples and dataset samples. But the sample space is often very high-dimensional (images) and sampling in this space is often hard. Markov-Chain Monte Carlo can be used, but is often very slow.\nSVGD on the other hand can learn a neural sampler, that is a neural network that learns to sample from the distribution given by the energy function. \n\n### Frameworks\nThis implementation is written using TensorFlow 2.0 and matplotlib. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanhuenermann%2Fsvgd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjanhuenermann%2Fsvgd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanhuenermann%2Fsvgd/lists"}