Skip to main content

A Python toolkit for introducing missing values into datasets

Project description

Welcome to PyGrinder

a Python toolkit for grinding data beans into the incomplete

Python version the latest release version BSD-3 license Community GitHub contributors GitHub Repo stars GitHub Repo forks Code Climate maintainability Coveralls report GitHub Testing arXiv DOI Conda downloads PyPI downloads

PyGrinder is a part of PyPOTS (a Python toolbox for data mining on Partially-Observed Time Series), was called PyCorruptor and separated from PyPOTS for decoupling missingness-creating functionalities from learning algorithms.

In data analysis and modeling, sometimes we may need to corrupt the original data to achieve our goal, for instance, evaluating models' ability to reconstruct corrupted data or assessing the model's performance on only partially-observed data. PyGrinder is such a tool to help you corrupt your data, which provides several patterns to create missing values in the given data.

❖ Usage Examples

PyGrinder now is available on ❗️

Install it with conda install pygrinder, you may need to specify the channel with option -c conda-forge

or install via PyPI:

pip install pygrinder

or install from source code:

pip install https://github.com/WenjieDu/PyGrinder/archive/main.zip

import numpy as np
from pygrinder import mcar, mar_logistic, mnar_x, mnar_t

# given a time-series dataset with 128 samples, each sample with 10 time steps and 36 data features
ts_dataset = np.random.randn(128, 10, 36)

# grind the dataset with MCAR pattern, 10% missing probability, and using 0 to fill missing values
X_with_mcar_data = mcar(ts_dataset, p=0.1)

# grind the dataset with MAR pattern
X_with_mar_data = mar_logistic(ts_dataset[:, 0, :], obs_rate=0.1, missing_rate=0.1)

# grind the dataset with MNAR pattern
X_with_mnar_x_data = mnar_x(ts_dataset, offset=0.1)
X_with_mnar_t_data = mnar_t(ts_dataset, cycle=20, pos = 10, scale = 3)

❖ Citing PyGrinder/PyPOTS

The paper introducing PyPOTS project is available on arXiv at this URL, and we are pursuing to publish it in prestigious academic venues, e.g. JMLR (track for Machine Learning Open Source Software). If you use PyGrinder in your work, please cite PyPOTS project as below and 🌟star this repository to make others notice this library. 🤗 Thank you!

@article{du2023pypots,
title={{PyPOTS: a Python toolbox for data mining on Partially-Observed Time Series}},
author={Wenjie Du},
year={2023},
eprint={2305.18811},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2305.18811},
doi={10.48550/arXiv.2305.18811},
}

Wenjie Du. (2023). PyPOTS: a Python toolbox for data mining on Partially-Observed Time Series. arXiv, abs/2305.18811.https://arxiv.org/abs/2305.18811

🏠 Visits

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

pygrinder-0.6.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

pygrinder-0.6-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

Details for the file pygrinder-0.6.tar.gz.

File metadata

  • Download URL: pygrinder-0.6.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.9

File hashes

Hashes for pygrinder-0.6.tar.gz
Algorithm Hash digest
SHA256 06cba1fd8101382c0215888623e3bae8e7a6ab2e76b829f4fbac3c506fda8db1
MD5 af48de668f298e87fa5af321bf4fe09f
BLAKE2b-256 b7f9c26c098cdfa2f829740a9555b5ec6e85fe9b9c50835b7913482ef863c6f3

See more details on using hashes here.

File details

Details for the file pygrinder-0.6-py3-none-any.whl.

File metadata

  • Download URL: pygrinder-0.6-py3-none-any.whl
  • Upload date:
  • Size: 19.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.9

File hashes

Hashes for pygrinder-0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 184ad251f2869007c36df30f9862035111ef1acbfbbc07c19575242802db3f51
MD5 35697545e4801d1188124da2a60c1b3e
BLAKE2b-256 f0f5ea9c6770de60bbdabab92ee904bc6460c34167bbe89d51eaf02a22c95364

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