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.3.0.tar.gz (104.5 kB view details)

Uploaded Source

Built Distribution

pydpmtest-0.3.0-py3-none-any.whl (123.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pydpmtest-0.3.0.tar.gz
  • Upload date:
  • Size: 104.5 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.3.0.tar.gz
Algorithm Hash digest
SHA256 3e89842c2cd433f467e42d590b3b55d8f5212fcaccc718919cd3761ed7b32b6b
MD5 dd3a3a9f74eb668ab70c44e7612898a8
BLAKE2b-256 8be6184c084912afe6ddf322921f5f5126d0b3851bfec3082fcc90b63a28448a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pydpmtest-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 123.6 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c723b4bee2638432652dbc683e2a9a78c6291a4ee9cccd273b50101a3983feeb
MD5 cca9d1b3d883bb5e2ee1a7e1e025e64f
BLAKE2b-256 1089126437d297e75cb8af41d4f04d02ff0fc91691daffd3bd8eca67edfde188

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