{"id":13671191,"url":"https://github.com/swyoon/pytorch-minimal-gaussian-process","last_synced_at":"2025-04-27T14:33:08.798Z","repository":{"id":175496084,"uuid":"443064437","full_name":"swyoon/pytorch-minimal-gaussian-process","owner":"swyoon","description":"A minimal implementation of Gaussian process regression in PyTorch","archived":false,"fork":false,"pushed_at":"2023-01-08T01:53:59.000Z","size":504,"stargazers_count":61,"open_issues_count":0,"forks_count":12,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-11T08:44:05.587Z","etag":null,"topics":["gaussian-process","gaussian-process-regression","gaussian-processes","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/swyoon.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}},"created_at":"2021-12-30T12:11:05.000Z","updated_at":"2024-10-25T06:07:22.000Z","dependencies_parsed_at":"2023-07-12T02:33:49.894Z","dependency_job_id":null,"html_url":"https://github.com/swyoon/pytorch-minimal-gaussian-process","commit_stats":null,"previous_names":["swyoon/pytorch-minimal-gaussian-process"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swyoon%2Fpytorch-minimal-gaussian-process","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swyoon%2Fpytorch-minimal-gaussian-process/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swyoon%2Fpytorch-minimal-gaussian-process/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swyoon%2Fpytorch-minimal-gaussian-process/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swyoon","download_url":"https://codeload.github.com/swyoon/pytorch-minimal-gaussian-process/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251154345,"owners_count":21544480,"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":["gaussian-process","gaussian-process-regression","gaussian-processes","pytorch"],"created_at":"2024-08-02T09:01:02.412Z","updated_at":"2025-04-27T14:33:08.270Z","avatar_url":"https://github.com/swyoon.png","language":"Jupyter Notebook","funding_links":[],"categories":["Jupyter Notebook"],"sub_categories":[],"readme":"# pytorch-minimal-gaussian-process\n\nIn search of truth, simplicity is needed. There exist heavy-weighted libraries, but as you know, we need to go bare bone sometimes.\nHere is a minimal implementation of Gaussian process regression in PyTorch.\n\nThe implementation generally follows Algorithm 2.1 in [Gaussian Process for Machine Learning (Rassmussen and Williams, 2006)](http://www.gaussianprocess.org/gpml/).\n\n\n* Author: [Sangwoong Yoon](https://swyoon.github.io/), [Hyeokjun Kwon](https://www.linkedin.com/in/hyeokjun-kwon-24b992210)\n\n## Features\n\n* Gaussian process regression with squared exponential kernel.\n* Hyperparameter optimization via marginal likelihood maximization using Pytorch built-in autograd functionality. (See `demo.ipynb`)\n* Unittesting using Pytest.\n\n## Updates\n\n* 2022-01-01: Bugfix in predictive variance computation\n* 2023-01-03: Implement binary Laplace Gaussian process regression\n\n## Dependency\n\n* Numpy\n* PyTorch\n* PyTest\n* Matplotlib (for demo)\n\n## How to Use\n### Gaussian process regression\n```python\nfrom gp import GP\n\n# generate data\nX = torch.randn(100,1)\ny = torch.sin(X * 2 * np.pi /4). + torch.randn(100, 1) * 0.1\ngrid = torch.linspace(-5, 5, 200)[:,None]\n\n# run GP\ngp = GP()  # you may specify initial hyperparameters using keyword arguments\ngp.fit(X, y)\nmu, var = gp.forward(grid)\n```\n\n### Gaussian process classification\n```python\nfrom gp import GP\n\n# generate data\nX = torch.randn(100,1)\nf = torch.sin(X * 3 * np.pi / 4)\ny = (f \u003e 0.).int() * 2 - 1\ngrid = torch.linspace(-5, 5, 200)[:,None]\n\n# run GP\ngp = BinaryLaplaceGPC()  # you may specify initial hyperparameters using keyword arguments\ngp.fit(X, y)\nmu, var, pi = gp.forward(grid)\n```\n## Unittesting\n\n```\n$ pytest\n```\n\n## See also\n\n* [GPyTorch](https://gpytorch.ai/): A full-featured Gaussian process package based on PyTorch.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswyoon%2Fpytorch-minimal-gaussian-process","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswyoon%2Fpytorch-minimal-gaussian-process","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswyoon%2Fpytorch-minimal-gaussian-process/lists"}