Skip to main content

Reconstructable preprocessor library

Project description

MIT License Build Status codecov

Prepnet

Reconstructable preprocessor library.

There are concepts of this library.

  • All pre-processes can save as a pickle.
  • Reconstructable pre-processes for feature analysis

Example

A simple example is see examples/01_iris.ipynb There is pre-process using prepnet for iris dataset in a part of example.

import prepnet 
from sklearn import datasets

# Load dataset.
iris = datasets.load_iris()
df = pd.DataFrame(iris.data, columns=iris.feature_names)
df['target'] = iris.target_names[iris.target]

# Scale by std and mean, and split 5 folds.
context = prepnet.FunctionalContext()
with context.enter('normalize'):
    # All pre-process method allow method chain.
    context[
        'sepal length (cm)',
        'sepal width (cm)',
        'petal length (cm)',
        'petal width (cm)',
    ].standardize()

# context.post is execute always after other preprocesses.
with context.enter('post'):
    context.split()

# convert python list object from prepnet.DataFrameArray.
preprocessed_df_list = list(context.encode(df))
# Concat first 4 element for train dataset.
train_df = pd.concat(preprocessed_df_list[:4], axis=0) 
# Use last element for test dataset.
test_df = preprocessed_df_list[-1]

And above preprocessor context can disable normalize easily

new_context = context.disable()
preprocessed_df_list = list(context.encode(df))
# Concat first 4 element for train dataset
nonnorm_train_df = pd.concat(preprocessed_df_list[:4], axis=0) 
# Use last element for test dataset
nonnorm_test_df = preprocessed_df_list[-1]

Do you ever remember this?

Boss: Hey, what's the difference between the new results and the old ones?

Someone: Well, some preprocesses are different.

Boss: Okay. Let me see the dataset.

Someone: Yes, sir. It's this and this.

Boss: What's the difference two datasets? The value that comes out of the difference is slightly, what's the difference in the preprocess?

Someone: Well, I just don't know.

Boss: Why? The dataset contains a commit idand you're managing source codes with git.

Someone: Even if I knew what version of the dataset it was created from. I would have commented out the details and preprocessed it...

Boss: Hey you...

Install

pip install prepnet

or

git clone https://github.com/elda27/prepnet
cd prepnet
python setup.py install

Test

python -m pytest --cov=prepnet

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

prepnet-0.2.0.tar.gz (12.3 kB view details)

Uploaded Source

Built Distributions

prepnet-0.2.0-py3.7.egg (64.1 kB view details)

Uploaded Source

prepnet-0.2.0-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file prepnet-0.2.0.tar.gz.

File metadata

  • Download URL: prepnet-0.2.0.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for prepnet-0.2.0.tar.gz
Algorithm Hash digest
SHA256 406c94ffe0b3ef40de3745eaf07f36efc5dc5b9ec517882ff846ac4132dc8ee9
MD5 254a75f5b414e6b21eda18b772edbb18
BLAKE2b-256 f6367319a79ac6a8f6b35554b0cca4b8681d58d0b045b1f2c507ca79d7d0c777

See more details on using hashes here.

File details

Details for the file prepnet-0.2.0-py3.7.egg.

File metadata

  • Download URL: prepnet-0.2.0-py3.7.egg
  • Upload date:
  • Size: 64.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for prepnet-0.2.0-py3.7.egg
Algorithm Hash digest
SHA256 56d7b2e93d79e10e12b2958dfff004cff94ebe3db7294f036ac6d6b8c9efad28
MD5 d66a7238efbda1636039945fcae360d3
BLAKE2b-256 145350738976da1623107f065c8d983b43e55cca9b89c9ca612b6d78db630651

See more details on using hashes here.

File details

Details for the file prepnet-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: prepnet-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for prepnet-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 31265609578f84339a2c7b450744841e550d0818d6fe437155be5861a49b8429
MD5 9f2428cb1deccbd79b5d8a8adb162626
BLAKE2b-256 9cde2479c829be9c3d63c7e2694c196200f9e8f13c725a3da636d95e7420c483

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