{"id":21678061,"url":"https://github.com/pnnl/ddks","last_synced_at":"2025-08-25T15:07:51.331Z","repository":{"id":42470435,"uuid":"379959583","full_name":"pnnl/DDKS","owner":"pnnl","description":"A high-dimensional Kolmogorov-Smirnov distance for comparing high dimensional distributions","archived":false,"fork":false,"pushed_at":"2022-09-20T14:27:38.000Z","size":2252,"stargazers_count":27,"open_issues_count":3,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-08T19:05:49.792Z","etag":null,"topics":["machine-learning","physics","statistics"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pnnl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-24T14:50:30.000Z","updated_at":"2025-04-02T18:21:48.000Z","dependencies_parsed_at":"2023-01-18T14:01:51.022Z","dependency_job_id":null,"html_url":"https://github.com/pnnl/DDKS","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pnnl/DDKS","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pnnl%2FDDKS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pnnl%2FDDKS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pnnl%2FDDKS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pnnl%2FDDKS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pnnl","download_url":"https://codeload.github.com/pnnl/DDKS/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pnnl%2FDDKS/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272084830,"owners_count":24870584,"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","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["machine-learning","physics","statistics"],"created_at":"2024-11-25T14:25:48.390Z","updated_at":"2025-08-25T15:07:51.165Z","avatar_url":"https://github.com/pnnl.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ddKS - a d-dimensional Kolmogorov-Smirnov Test\n\n*Alex Hagen\u003csup\u003e1\u003c/sup\u003e, Shane Jackson\u003csup\u003e1\u003c/sup\u003e, James Kahn\u003csup\u003e2\u003c/sup\u003e, Jan Strube\u003csup\u003e1\u003c/sup\u003e, Isabel Haide\u003csup\u003e2\u003c/sup\u003e, Karl Pazdernik\u003csup\u003e1\u003c/sup\u003e, and Connor Hainje\u003csup\u003e1\u003c/sup\u003e*\n\n\u003csup\u003e1\u003c/sup\u003e: Pacific Northwest National Laboratory, \n\u003csup\u003e2\u003c/sup\u003e: Karlsruhe Institute of Technology\n\nThis code accompanies our paper submitted to IEEE Transactions on\nPattern Analysis and Machine Intelligence titled \"Accelerated Computation of a\nHigh Dimensional Kolmogorov-Smirnov Distance\" ([arXiv](https://arxiv.org/abs/2106.13706)).  \n\nAs of 6/25/2021 there are 3 methods implemented:\n\n* ddKS - d-dimensional KS test caclulated per\n    * Variable splitting of space (all points, subsample, grid spacing)\n* rdKS - ddKS approximation using distance from (d+1) corners\n* vdKS - ddKS approximation calculating ddks distance between voxels instead of points\n\n\n\n# Quickstart\n\nInstallation of `ddks` should be pretty easy, simple run\n\n```bash\npip install git+https://github.com/pnnl/DDKS\n```\n\nor, if you want to develop on DDKS, simply clone this repository into a safe\nspot on your computer and run\n\n```bash\npip install -e .\n```\n\nfrom the top level of the repository.\n\nThen, you can get started used the\nrepository by starting a `ddks` object and performing the distance calculation\non any pair of torch tensors that are `sample_size` x `dimension`.\n\n```python\nimport torch\nimport ddks\n\np = torch.rand((100, 3))\nt = torch.rand((50, 3))\n\ncalculation = ddks.methods.ddKS()\ndistance = calculation(p, t)\nprint(f\"The ddKS distance is {distance}\")\n```\n\nTo operate on GPU, all you need to do is move the tensors to the device before\ncalculation:\n\n```python\np = torch.rand((100, 3)).to('cuda:0')\nt = torch.rand((50, 3)).to('cuda:0')\n\ncalculation = ddks.methods.ddKS()\ndistance = calculation(p, t)\n```\n\nIf you want to use a different accelerated method, simply use\n`ddks.methods.rdKS` or `ddks.methods.vdKS`. Note that rdKS and vdKS cannot use\nGPU.\n\n# Package Structure:\n1. methods - Callable classes for xdks methods [x=d,r,v]\n1. data - Contains several data generators to play around with\n1. run_scripts - Contains an example run script \n1. Unit_tests - Contains unit tests for repo   \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpnnl%2Fddks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpnnl%2Fddks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpnnl%2Fddks/lists"}