/litds

PyTorch Lightning Data Modules

Primary LanguageJupyter NotebookApache License 2.0Apache-2.0

litds

Developer Guide

Setup

# create conda environment
$ mamba env create -f env.yml

# update conda environment
$ mamba env update -n litds --file env.yml

Install

pip install -e .

# install from pypi
pip install litds

nbdev

# activate conda environment
$ conda activate litds

# make sure the litds package is installed in development mode
$ pip install -e .

# make changes under nbs/ directory
# ...

# compile to have changes apply to the litds package
$ nbdev_prepare

Publishing

# publish to pypi
$ nbdev_pypi

# publish to conda
$ nbdev_conda --build_args '-c conda-forge'
# $ nbdev_conda --mambabuild --build_args '-c conda-forge -c pytorch -c bioconda -c dsm-72'

Usage

Installation

Install latest from the GitHub repository:

$ pip install git+https://github.com/dsm-72/litds.git

or from conda

$ conda install -c dsm-72 litds

or from pypi

$ pip install litds

Documentation

Documentation can be found hosted on GitHub repository pages. Additionally you can find package manager specific guidelines on conda and pypi respectively.

Brief Datasets Demo

dd = DiamondsDataset()
dd.getone()
(tensor([[ 0.0491,  0.0015],
         [ 0.1555,  0.3419],
         [-0.3727,  0.3598],
         [ 0.6811,  0.3734],
         [ 0.4492, -0.7379]]),
 tensor([0., 1., 2., 3., 4.]))
dd.plot(palette='mako_r')

od = OrbitsDataset()
od.getone()
(tensor([[ 0.0203, -0.2043],
         [-0.3889, -0.1781],
         [ 0.0290,  0.6299],
         [-0.3386,  0.8402],
         [ 0.9571,  0.0337]]),
 tensor([0., 1., 2., 3., 4.]))
od.plot(palette='mako_r')

eb = EmbryoidBodies2018DataModule(
    primary='pca',
    batch_size=8,
)
eb.setup()
EB Loader:   0%|          | 0/126 [00:00<?, ?it/s]

Loading data
Data ready!
dl = eb.train_dataloader()
eb.train_ds.df[eb.train_ds.df.columns[-5:]].head()
<style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; } .dataframe tbody tr th { vertical-align: top; } .dataframe thead th { text-align: right; } </style>
d97 d98 d99 d100 samples
4854 -0.633847 -0.701649 -1.466198 -0.381950 Day 06-09
6121 0.432789 1.089373 -0.968371 -0.211686 Day 06-09
7620 0.042552 0.870117 -1.264836 -1.664296 Day 12-15
12560 1.770667 -0.594136 1.893129 -1.064998 Day 18-21
10336 -2.947320 -1.072601 1.554807 0.170369 Day 18-21