Skip to main content

A small example package

Project description

DNA-SE: Towards Deep Neural-Net Assisted Semiparametric Estimation

DNA-SE is an approach for solving the parameter of interest in semi-parametric. We give 3 examples about missing not at random, sensitivity analysis in causal inference and transfer learning. DNA-SE proposes a method using deep neural network to estimate or calculate the parameters with the solution given by integral equation. Also it has a iterative alternating procedure with Monte Carlo integration and a new loss function. Furthermore, we support a python package with pytorch to use our algorithm directly.

Setup

For the requirments, the DNA-SE methods depend on python>=3.7, torch>=1.12, time package.

Using the following command in Python to install:

conda create -n --envname python>=3.7
conda activate --envname
conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia

Figures and Networks

For our method, we choose simple neural networks and prove it is useful to solve integral equations. And we suppose the bi-level algorithm which is shown in

Usage

The specific three examples for MNAR, Sensitivity analysis and Transfer learning, we give the codes in mnar.py, sensitivity_simu.py and transfer_learning.py which are available for you to reproduce our results.

Also in order to use our algorithm more easily, we give a simple package in python and you can check the file model.

For the usage of this package, you should first install the package DNA_SE into your server. The command of this is:

pip install DNA_SE

Then you can use the function dnase in this package:

from DNA_SE import dnase

Alternating Usage

Also if you want to modify the code by yourself, you can choose to download the repository from this github:

git clone https://github.com/liuqs111/DNA-SE.git

Then enter the path of model in this file:

cd DNA_SE/package/DNA_SE

And you can use the function by running the command below in command line:

from DNA_SE import dnase

Function Usage

dnase(p, Oi, BATCHSIZE, EPOCH, M, B, input_dim, hidden_dim, output_dim, K_func, C_func, psi_func, depth, activation = 'tanh', device = torch.device('cuda' if torch.cuda.is_available() else 'cpu'))

p: int, the number of features X;

Oi: np.array, the observed data;

BATCHSIZE: int, the batch size;

EPOCH: int, the number of epochs;

M: int, the Monte Carlo number of data points for t;

B: int, the Monto Carlo number of data points for s;

input_dim: int, the input dimension of the model;

hidden_dim: int, the hidden dimension of the model;

output_dim: int, the output dimension of the model;

K_func: function, the kernel function;

C_func: function, the function to calculate the integral;

psi_func: function, the function to calculate the psi function;

depth: int, the depth of the model L;

activation: str, the activation function [relu, sigmoid, tanh];

device: torch.device, the device to run the model.

Value

return model_b, beta.data(), optimizer_b, optimizer_beta

where beta.data() is used to get the value of beta. Also you can check the model and optimizer and choose as you like.

Details

For the choice of parameters, for our three examples we choose tanh() as our activate function and the dimension of input, hidden and output are chosen by grid search. Also the original data O depends on yourself. You can modify the dataload of training data to satisfy different requirements, for example, using all original data or part original data given in datasets. Therefore we recommand you to download the code from this github and modify as you like. Also you can choose more deep networks to train your model which may perform better for your specific calculation.

For our three examples, since their functions are so complex, therefore we give the three unique python files for you to check and reproduce.

Reference:

Qinshuo Liu, Zixin Wang, Xi-An Li, Xinyao Ji, Lei Zhang, LL#, and Zhonghua Liu#. DNA-SE: Towards Deep Neural-Nets Assisted Semiparametric Estimation. (2024). International Conference on Machine Learning.

Acknowledgement

The authors would like to thank BaoLuo Sun for helpful dis- cussions. Lin Liu is supported by NSFC Grant No.12101397 and No.12090024, Shanghai Science and Technology Com- mission Grant No.21ZR1431000 and No.21JC1402900, and Shanghai Municipal Science and Technology Major Project No.2021SHZDZX0102. Zixin Wang and Lei Zhang are also supported by Shanghai Science and Technology Commis- sion Grant No.21ZR1431000. Lin Liu is also affiliated with Shanghai Artificial Intelligence Laboratory and the Smart Justice Lab of Koguan Law School of SJTU. Zhonghua Liu is also affiliated with Columbia University Data Science Institute.

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

DNA_SE-0.1.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

DNA_SE-0.1.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file DNA_SE-0.1.0.tar.gz.

File metadata

  • Download URL: DNA_SE-0.1.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.8.19

File hashes

Hashes for DNA_SE-0.1.0.tar.gz
Algorithm Hash digest
SHA256 021d0cb9e5d22dfdbf220498bbbc099c16e6a4b2c34a67f2684f82ebfe8ee42e
MD5 5032126e79c2316bac9600744aa62968
BLAKE2b-256 60c342398e86bb70fb9d3974c4b6e499aff0f46534def7edb60c13efc29bf41d

See more details on using hashes here.

File details

Details for the file DNA_SE-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: DNA_SE-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.8.19

File hashes

Hashes for DNA_SE-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e98c452f306cdf4fb67a1549dafaf88292e5b5c451ce655e182e8c80125bc701
MD5 ab1e4e962db2f6b52ebbcb6d2b63ef6d
BLAKE2b-256 2d09c77e1097e543c7ec3b02802c3f6db3bfdf33689f9cf9db1647ab7f04949a

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