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 Distributions
Built Distribution
File details
Details for the file pydpmtest-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: pydpmtest-0.1.1-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 488b0581a182fb85dddd2128161dcfc52d5a20440eeca77c217acbd14a49ad49 |
|
MD5 | 17c24755a1bd3ef6279f1825a51c2a52 |
|
BLAKE2b-256 | 2792e15221734f18b6c96a4c22a59b05f72951a04eaca4dfc7099ba6b3806bd1 |