Skip to main content

A python library focuses on constructing deep probabilistic models on GPU.

Project description

Pydpm

A python package focuses on constructing deep probabilistic models on GPU. Pydpm provides efficient distribution sampling functions and has included lots of probabilistic models.

Install

Temporarily support Linux system only and the Windows version will be launched soon.

pip install pydpm

Requirements

pycuda
scipy
numpy

Create Probabilistic Model

Model list

Model list is as following:

Whole name Model Paper
Latent Dirichlet Allocation LDA Link
Poisson Factor Analysis PFA Link
Poisson Gamma Belief Network PGBN Link
Convolutional Poisson Factor Analysis CPFA Link
Convolutional Poisson Gamma Belief Network CPGBN Link
Poisson Gamma Dynamical Systems PGDS Link
Deep Poisson Gamma Dynamical Systems DPGDS Link

More probabilistic models will be included further...

Demo

Create a PGBN model:

from pydpm.model import PGBN
test_model = PGBN([128, 64, 32], device='gpu')
test_model.initial(train_data)
test_model.train(100)

More complete demos can be found in pydpm/examples/...

Layer construction

Construct your own probabilistic model as you wish.

from pydpm.layer import data_base,prob_layer,model
data = data_base('./mnist_gray')
layer1 = prob_layer(128)
layer2 = prob_layer(64)
layer3 = prob_layer(32)
pgbn = model([data, layer1, layer2, layer3],'gpu')
pgbn.train(iter=100)

This module is under construction and will be launched soon...

Sample on GPU

Function list

The parameters of partial distribution functions are as following:

Function Parameters List
Normal mean,std,times
Multinomial count,prob,times
Poisson lambda,times
Gamma shape,scale,times
Beta alpha,beta,times
F n1,n2,times
StudentT n,times
Dirichlet alpha,times
Crt point,p,times
Weibull shape,scale,times
Chisquare n,times
Geometric p,times
... ...

Example

import pydpm.distribution as dsg
a=dsg.gamma(1.5,1,100000)
b=dsg.gamma([1.5,2.5],[1,2],100000)

More complete demos can be found in pydpm/distribution/...

Compare

Compare the sampling speed of distribution functions with numpy: Image text The compared code can be found in pydpm/example/Sample_Demo.py

Compare the sampling speed of distribution functions with tensorflow and torch: Image text The compared code can be found in pydpm/example/Sample_Demo2.py

Contact

License: Apache License Version 2.0

Contact: Chaojie Wang xd_silly@163.com, Wei Zhao 13279389260@163.com, Jiawen Wu wjw19960807@163.com

Copyright (c), 2020, Chaojie Wang, Wei Zhao, Jiawen Wu, Bo Chen and Mingyuan Zhou

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

pydpmtest-0.2.0.tar.gz (88.9 kB view details)

Uploaded Source

Built Distribution

pydpmtest-0.2.0-py3-none-any.whl (105.3 kB view details)

Uploaded Python 3

File details

Details for the file pydpmtest-0.2.0.tar.gz.

File metadata

  • Download URL: pydpmtest-0.2.0.tar.gz
  • Upload date:
  • Size: 88.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.5.0.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for pydpmtest-0.2.0.tar.gz
Algorithm Hash digest
SHA256 acab2b6ed200f3a696805ff45b0021df34c3d0fc3425de57bf7c5c6a54f5d5c6
MD5 c6748740c9026da1f4a1fe90389b030e
BLAKE2b-256 a8a273a13ed81f416af04e8426f5c6902eb0e0662e71c5ed6c180bf6f31434f1

See more details on using hashes here.

File details

Details for the file pydpmtest-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pydpmtest-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 105.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.5.0.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for pydpmtest-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6a43e71e8cfed2131546a0fe3e1f11dfbefe20757dd3bf3d173d26f8c843ddf1
MD5 73f6925f292ae103a61a423a2da950f6
BLAKE2b-256 54c8508da348b063fadd426611bdf3ee3db95ef58e43a023dafc9a6b6905b06f

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