Metadata-Version: 2.1
Name: nnlite
Version: 0.0.2
Summary: Some utilities and wrappers for Neural Network Models
Home-page: https://github.com/huangyh09/nnlite
Author: ['NNWrapper Team']
Author-email: yuanhua@hku.hk
License: Apache-2.0
Keywords: Neural Network Models,Machine Learning
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.9.0
Requires-Dist: scipy>=1.4.0
Requires-Dist: matplotlib
Requires-Dist: pandas
Requires-Dist: scikit-learn
Requires-Dist: torch
Requires-Dist: tqdm
Provides-Extra: docs
Requires-Dist: sphinx_bootstrap_theme; extra == "docs"

# nnwrapper
A light toolbox with utilities and wrappers for Neural Network Models


## Install

```
# for published version
pip install -U nnlite

# or developing version
pip install -U git+https://github.com/huangyh09/nnlite
```

## Quick Usage

```python
from nnlite import NNWrapper
from functools import partial

torch.manual_seed(0)
dev = 'cuda:0' if torch.cuda.is_available() else 'cpu'

## VAE model (one hidden layer, dim=64), loss, and optimizer
model = nnwrapper.models.VAE_base(1838, 32, hidden_dims=[64], device=dev)
criterion = partial(nnwrapper.models.Loss_VAE_Gaussian, beta=1e-3)
optimizer = torch.optim.Adam(model.parameters(), lr=1e-3, weight_decay=0.95)

## NNWrapper for model training
my_wrapper = NNWrapper(model, criterion, optimizer, device=dev)
my_wrapper.fit(train_loader, epoch=3000, validation_loader=None, verbose=False)
my_wrapper.predict(test_loader)

plt.plot(my_wrapper.train_losses)
```


## Examples
See the [examples](./examples) folder, including
* CNN-1D: [CamoTSS-CNN-demo.ipynb](./examples/CamoTSS-CNN-demo.ipynb)
* VAE for 3K PBMC: [PBMC3K_VAE.ipynb](./examples/PBMC3K_VAE.ipynb)
* and more.
