Skip to main content

A package for common data science operations

Project description

Data Transformation Library

This Python library provides functions commonly used for transforming data in machine learning models. The library is designed to be lightweight, efficient, and easy to use.

Functions

1. Transpose

The transpose2d function switches the axes of a 2D tensor (matrix). This operation is frequently used in data science workflows for various data manipulation tasks.

Signature:

def transpose2d(input_matrix: list[list[float]]) -> list[list[float]]:
    ...

Usage:

input_matrix = [
    [1, 2, 3],
    [4, 5, 6]
]
output_matrix = transpose2d(input_matrix)

2. Time Series Windowing

The window1d function creates a sliding window over a 1D array of data. This is particularly useful for time series analysis and modeling tasks, allowing data to be split into overlapping or non-overlapping windows for processing.

Signature:

def window1d(input_array: list | np.ndarray, size: int, shift: int = 1, stride: int = 1) -> list[list | np.ndarray]:
    ...

Usage:

input_array = [1, 2, 3, 4, 5, 6]
window_size = 3
window_shift = 1
window_stride = 1
windows = window1d(input_array, window_size, window_shift, window_stride)

3. Cross-Correlation

The convolution2d function performs cross-correlation between a 2D input matrix and a kernel matrix. Although often referred to as convolution, in deep learning, it is essentially cross-correlation. This function is commonly used in convolutional neural networks (CNNs) for feature extraction.

Signature:

def convolution2d(input_matrix: np.ndarray, kernel: np.ndarray, stride: int = 1) -> np.ndarray:
    ...

Usage:

input_matrix = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
kernel = np.array([[1, 0], [0, -1]])
stride = 1
output_matrix = convolution2d(input_matrix, kernel, stride)

Project Structure

DataTransformation_library/
│
├── DataTransformation/
│   ├── __init__.py
│   ├── transpose.py
│   ├── window.py
│   └── convolution.py
│
├── tests/
│   ├── __init__.py
│   ├── test_transpose.py
│   ├── test_window.py
│   └── test_convolution.py
│
├── README.md
├── LICENSE
├── pyproject.toml
└── poetry.lock

Installation

You can install the library via pip:

pip install DataTransformation

Dependencies

  • Python (>=3.6)
  • NumPy (>=1.26.4)

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

datatransformation-0.1.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

datatransformation-0.1.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file datatransformation-0.1.1.tar.gz.

File metadata

  • Download URL: datatransformation-0.1.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.9.16 Darwin/21.6.0

File hashes

Hashes for datatransformation-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5c3e5fa044b4741343a0c578a58a90dbfd37cb65df68473b8e042698178a886e
MD5 0dc3f3363b1db5713f2e7e4f84bf91ce
BLAKE2b-256 dceee44db8af20a130239ec069c14b1b058c9c8c16495bc02b918c46bc3444bc

See more details on using hashes here.

File details

Details for the file datatransformation-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: datatransformation-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.9.16 Darwin/21.6.0

File hashes

Hashes for datatransformation-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6efc1317fb69c47a0409ad58a5c85b01854d20ce616903c62f971cf741b48d54
MD5 57fe6b84d6411746dd277772ca2888b3
BLAKE2b-256 5b11a45523ae96a658feb42eb4870c1de1ee5971fe983479adf2ce89a47a3895

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