Skip to main content

A library for data science teams to avoid code duplication in common tasks involving scikit-learn transformers and estimators.

Project description

Data Science Utils

A toolkit for day-to-day DS tasks such as using custom transformers or estimators.

Found a bug or have a feature request? Open an issue!

Usage

First, import the library:

import pier_ds_utils as ds

Transformers

discrete_categorizer = ds.transformer.CustomDiscreteCategorizer(...)
interval_categorizer = ds.transformer.CustomIntervalCategorizer(...)
interval_categorizer_by_category = ds.transformer.CustomIntervalCategorizerByCategory(...)
log_transformer = ds.transformer.LogTransformer()

Estimators

glm_wrapper = ds.estimator.GLMWrapper(...)
predict_proba_selector = ds.estimator.PredictProbaSelector(...)

Predictors

predictor = ds.predictor.StaticGLM(...)

Example usage:

from pier_ds_utils.predictor import StaticGLM
import pandas as pd

glm = StaticGLM(
    coefficients_map={"feature1": 0.5, "feature2": 1.5},  # required
    constant=2.0,  # optional
    os_factor=1.0,  # optional
)

df = pd.DataFrame({"feature1": [1, 2], "feature2": [3, 4]})

# The predict is equivalent to:
# y = (0.5 * feature1 + 1.5 * feature2 + constant) * os_factor
print(glm.predict(df))  # Output: [7. 9.]

Installation

pip install pier-ds-utils

# or

poetry add pier-ds-utils

For a specific version:

pip install pier-ds-utils@_version_

# or

poetry add pier-ds-utils@_version_

Contributing

Contributions are welcome! Please read the contributing guidelines first.

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

pier_ds_utils-0.5.0a2.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pier_ds_utils-0.5.0a2-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file pier_ds_utils-0.5.0a2.tar.gz.

File metadata

  • Download URL: pier_ds_utils-0.5.0a2.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.11 Linux/6.8.0-1021-azure

File hashes

Hashes for pier_ds_utils-0.5.0a2.tar.gz
Algorithm Hash digest
SHA256 fda5b639b06fe13f6ddf6b329f5ff83fe87c8ccb1ed36f99ebeedd9ccb7ddd0b
MD5 80a30a5241152571795b1128064c30ba
BLAKE2b-256 a88933b52b853c34d5afaf8e8f1e823119afa25b5c7057260cf544439e0daf84

See more details on using hashes here.

File details

Details for the file pier_ds_utils-0.5.0a2-py3-none-any.whl.

File metadata

  • Download URL: pier_ds_utils-0.5.0a2-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.11 Linux/6.8.0-1021-azure

File hashes

Hashes for pier_ds_utils-0.5.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 0e44ecb7b206c389fa345bffd6a6cc7a058348b0cc6f766febbb3c7e3196a5bc
MD5 91832a00545cac892818162280337324
BLAKE2b-256 3f4e7da5ace9f0938b98a16f8b2ab17f7d9a3b887e662856ad9a206dd7cc6112

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page