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: The compared code can be found in pydpm/example/Sample_Demo.py
Compare the sampling speed of distribution functions with tensorflow and torch: 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
Built Distribution
File details
Details for the file pydpmtest-0.2.1.tar.gz
.
File metadata
- Download URL: pydpmtest-0.2.1.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b05cc0b6615f2f1b49ebc0a4a09cbca8e9e03f6f04be63bbd1ba0fadf442117 |
|
MD5 | 545580558d1cf280354b8fc9c10713c3 |
|
BLAKE2b-256 | 12a7457f8e0e5ec6c603eeedb3dfd3b6b7fd889333bd030b20d48a8d034a96be |
File details
Details for the file pydpmtest-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: pydpmtest-0.2.1-py3-none-any.whl
- Upload date:
- Size: 59.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d93fa6a56005adad3d9899ae6bc84b166266f3e8c3fad755802c80379aaac9b |
|
MD5 | 7b4d6c7d12dbcfdbb6539ef0562f9a75 |
|
BLAKE2b-256 | b69ef131548d77a7adba31dca9f357cca3f82d2fed281af9bee1a5b66b284627 |