Git Product home page Git Product logo

ddks's Introduction

ddKS - a d-dimensional Kolmogorov-Smirnov Test

Alex Hagen1, Shane Jackson1, James Kahn2, Jan Strube1, Isabel Haide2, Karl Pazdernik1, and Connor Hainje1

1: Pacific Northwest National Laboratory, 2: Karlsruhe Institute of Technology

This code accompanies our paper submitted to IEEE Transactions on Pattern Analysis and Machine Intelligence titled "Accelerated Computation of a High Dimensional Kolmogorov-Smirnov Distance" (arXiv).

As of 6/25/2021 there are 3 methods implemented:

  • ddKS - d-dimensional KS test caclulated per
    • Variable splitting of space (all points, subsample, grid spacing)
  • rdKS - ddKS approximation using distance from (d+1) corners
  • vdKS - ddKS approximation calculating ddks distance between voxels instead of points

Quickstart

Installation of ddks should be pretty easy, simple run

pip install git+https://github.com/pnnl/DDKS

or, if you want to develop on DDKS, simply clone this repository into a safe spot on your computer and run

pip install -e .

from the top level of the repository.

Then, you can get started used the repository by starting a ddks object and performing the distance calculation on any pair of torch tensors that are sample_size x dimension.

import torch
import ddks

p = torch.rand((100, 3))
t = torch.rand((50, 3))

calculation = ddks.methods.ddKS()
distance = calculation(p, t)
print(f"The ddKS distance is {distance}")

To operate on GPU, all you need to do is move the tensors to the device before calculation:

p = torch.rand((100, 3)).to('cuda:0')
t = torch.rand((50, 3)).to('cuda:0')

calculation = ddks.methods.ddKS()
distance = calculation(p, t)

If you want to use a different accelerated method, simply use ddks.methods.rdKS or ddks.methods.vdKS. Note that rdKS and vdKS cannot use GPU.

Package Structure:

  1. methods - Callable classes for xdks methods [x=d,r,v]
  2. data - Contains several data generators to play around with
  3. run_scripts - Contains an example run script
  4. Unit_tests - Contains unit tests for repo

ddks's People

Contributors

alexhagen avatar psteinb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.