datasetops

Fluent dataset operations, compatible with your favorite libraries

https://github.com/lukashedegaard/datasetops

Science Score: 57.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.9%) to scientific vocabulary

Keywords

data-cleaning data-munging data-processing data-science data-wrangling dataset dataset-combinations deep-learning multiple-datasets pytorch tensorflow
Last synced: 4 months ago · JSON representation ·

Repository

Fluent dataset operations, compatible with your favorite libraries

Basic Info
Statistics
  • Stars: 11
  • Watchers: 4
  • Forks: 0
  • Open Issues: 19
  • Releases: 0
Topics
data-cleaning data-munging data-processing data-science data-wrangling dataset dataset-combinations deep-learning multiple-datasets pytorch tensorflow
Created almost 6 years ago · Last pushed about 3 years ago
Metadata Files
Readme License Citation

README.md


Dataset Ops: Fluent dataset operations, compatible with your favorite libraries

Python package Documentation Status codecov Code style: black

Dataset Ops provides a fluent interface for loading, filtering, transforming, splitting, and combining datasets. Designed specifically with data science and machine learning applications in mind, it integrates seamlessly with Tensorflow and PyTorch.

Appetizer

```python import datasetops as do

prepare your data

train, val, test = ( do.fromfolderclassdata('path/to/data/folder') .named("data", "label") .imageresize((240, 240)) .one_hot("label") .shuffle(seed=42) .split([0.6, 0.2, 0.2]) )

use with your favorite framework

traintf = train.totensorflow() trainpt = train.topytorch()

or do your own thing

for img, label in train: ... ```

Installation

Binary installers available at the Python package index bash pip install datasetops

Why?

Collecting and preprocessing datasets is tiresome and often takes upwards of 50% of the effort spent in the data science and machine learning lifecycle. While Tensorflow and PyTorch have some useful datasets utilities available, they are designed specifically with the respective frameworks in mind. Unsuprisingly, this makes it hard to switch between them, and training-ready dataset definitions are bound to one or the other. Moreover, they do not aid you in standard scenarios where you want to: - Sample your dataset non-random ways (e.g with a fixed number of samples per class) - Center, standardize, normalise you data - Combine multiple datasets, e.g. for parallel input to a multi-stream network - Create non-standard data splits

Dataset Ops aims to make these processing steps easier, faster, and more intuitive to perform, while retaining full compatibility to and from the leading libraries. This also means you can grab a dataset from torchvision datasets and use it directly with tensorflow:

```python import do import torchvision

torchusps = torchvision.datasets.USPS('../dataset/path', download=True) tensorflowusps = do.frompytorch(torchusps).to_tensorflow() ```

Development Status

The library is still under heavy development and the API may be subject to change.

What follows here is a list of implemented and planned features.

Loaders

  • [x] Loader (utility class used to define a dataset)
  • [x] from_pytorch (load from a torch.utils.data.Dataset)
  • [x] from_tensorflow (load from a tf.data.Dataset)
  • [x] from_folder_data (load flat folder with data)
  • [x] from_folder_class_data (load nested folder with a folder for each class)
  • [x] from_folder_dataset_class_data (load nested folder with multiple datasets, each with a nested class folder structure )
  • [ ] from_mat (load contents of a .mat file as a single dataaset)
  • [x] from_mat_single_mult_data (load contents of a .mat file as multiple dataasets)
  • [ ] load (load data from a path, automatically inferring type and structure)

Converters

  • [x] to_tensorflow (convert Dataset into tensorflow.data.Dataset)
  • [x] to_pytorch (convert Dataset into torchvision.Dataset)

Dataset information

  • [x] shape (get shape of a dataset item)
  • [x] counts (compute the counts of each unique item in the dataset by key)
  • [x] unique (get a list of unique items in the dataset by key)
  • [x] named (supply names for the item elements)
  • [x] names (get a list of names for the elements in an item)
  • [ ] stats (provide an overview of the dataset statistics)
  • [ ] origin (provide an description of how the dataset was made)

Sampling and splitting

  • [x] shuffle (shuffle the items in a dataset randomly)
  • [x] sample (sample data at random a dataset)
  • [x] filter (filter the dataset using a predicate)
  • [x] split (split a dataset randomly based on fractions)
  • [x] split_filter (split a dataset into two based on a predicate)
  • [x] allow_unique (handy predicate used for balanced classwise filtering/sampling)
  • [x] take (take the first items in dataset)
  • [x] repeat (repeat the items in a dataset, either itemwise or as a whole)

Item manipulation

  • [x] reorder (reorder the elements of the dataset items (e.g. flip label and data order))
  • [x] transform (transform function which takes other functions and applies them to the dataset items.)
  • [x] categorical (transforms an element into a categorical integer encoded label)
  • [x] one_hot (transforms an element into a one-hot encoded label)
  • [x] numpy (transforms an element into a numpy.ndarray)
  • [x] reshape (reshapes numpy.ndarray elements)
  • [x] image (transforms a numpy array or path string into a PIL.Image.Image)
  • [x] image_resize (resizes PIL.Image.Image elements)
  • [ ] image_crop (crops PIL.Image.Image elements)
  • [ ] image_rotate (rotates PIL.Image.Image elements)
  • [ ] image_transform (transforms PIL.Image.Image elements)
  • [ ] image_brightness (modify brightness of PIL.Image.Image elements)
  • [ ] image_contrast (modify contrast of PIL.Image.Image elements)
  • [ ] image_filter (apply an image filter to PIL.Image.Image elements)
  • [ ] noise (adds noise to the data)
  • [ ] center (modify each item according to dataset statistics)
  • [ ] normalize (modify each item according to dataset statistics)
  • [ ] standardize (modify each item according to dataset statistics)
  • [ ] whiten (modify each item according to dataset statistics)
  • [ ] randomly (apply data transformations with some probability)

Dataset combinations

  • [x] concat (concatenate two datasets, placing the items of one after the other)
  • [x] zip (zip datasets itemwise, extending the size of each item)
  • [x] cartesian_product (create a dataset whose items are all combinations of items (zipped) of the originating datasets)

Citation

If you use this software, please cite it as below: bibtex @software{Hedegaard_DatasetOps_2022, author = {Hedegaard, Lukas and Oleksiienko, Illia and Legaard, Christian Møldrup}, doi = {10.5281/zenodo.7223644}, month = {10}, title = {{DatasetOps}}, version = {0.0.7}, year = {2022} }

Owner

  • Name: Lukas Hedegaard
  • Login: LukasHedegaard
  • Kind: user
  • Location: Aarhus, Denmark
  • Company: Aarhus University

Deep Learning Researcher

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
  - family-names: Hedegaard
    given-names: Lukas
    orcid: https://orcid.org/0000-0002-2841-864X
  - family-names: Oleksiienko
    given-names: Illia
    orcid: https://orcid.org/0000-0001-7592-365X
  - family-names: Legaard
    given-names: Christian Møldrup
    orcid: https://orcid.org/0000-0002-1914-9863
title: "DatasetOps"
version: 0.0.7
doi: 10.5281/zenodo.7223644
date-released: 2022-10-19

GitHub Events

Total
  • Watch event: 1
  • Pull request event: 1
  • Create event: 1
Last Year
  • Watch event: 1
  • Pull request event: 1
  • Create event: 1

Committers

Last synced: almost 2 years ago

All Time
  • Total Commits: 147
  • Total Committers: 6
  • Avg Commits per committer: 24.5
  • Development Distribution Score (DDS): 0.259
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
LukasHedegaard lh@e****k 109
Christian Legaard c****d@o****m 18
Lukas Hedegaard Jensen a****8@d****k 13
Christian Møldrup Legaard c****d 4
Illia Oleksiienko i****3@g****m 2
Lukas Hedegaard l****d@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 29
  • Total pull requests: 17
  • Average time to close issues: 9 days
  • Average time to close pull requests: 1 day
  • Total issue authors: 3
  • Total pull request authors: 3
  • Average comments per issue: 1.24
  • Average comments per pull request: 1.35
  • Merged pull requests: 13
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • LukasHedegaard (16)
  • clegaard (9)
  • iliiliiliili (4)
Pull Request Authors
  • LukasHedegaard (11)
  • clegaard (4)
  • iliiliiliili (2)
Top Labels
Issue Labels
enhancement (11) bug (4) behaviour (4) documentation (3) question (2) cosmetics (2) removal (1)
Pull Request Labels
enhancement (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 20 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 4
  • Total versions: 4
  • Total maintainers: 1
pypi.org: datasetops

Fluent dataset operations, compatible with your favorite libraries

  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 4
  • Downloads: 20 Last month
Rankings
Dependent repos count: 7.5%
Dependent packages count: 10.1%
Average: 16.6%
Stargazers count: 17.1%
Forks count: 22.7%
Downloads: 25.4%
Maintainers (1)
Last synced: 4 months ago

Dependencies

setup.py pypi
  • numpy *