Skip to main content

The Data Transformation Library is a Python package designed to provide a set of functions for common data transformation tasks, such as transposing matrices, performing convolutions.

Project description

Data Transformation Library

Description

The Data Transformation Library is a Python package designed to provide a set of functions for common data transformation tasks, such as transposing matrices, performing convolutions. This library aims to simplify data preprocessing and manipulation for machine learning and data analysis applications. There are three functions in the library:

  • transpose2d: Switches the axes of a 2D tensor.
  • window1d: Generates windows from a 1D time series array.
  • convolution2d: Computes the cross-correlation of a 2D matrix with a kernel.

Library can be found: https://pypi.org/project/data-transformation-library-ingri/

Features

Transpose 2D Matrix
  • Signature: transpose2d(input_matrix: list[list[float]]) -> list
  • Input: A list of lists of real numbers representing a 2D matrix.
  • Output: A transposed 2D matrix.
  • Implementation: Implemented using only Python and its standard library.
Time Series Windowing
  • Signature: window1d(input_array: list | np.ndarray, size: int, shift: int = 1, stride: int = 1) -> list[list | np.ndarray]
  • Input: A list or 1D Numpy array of real numbers, along with parameters for window size (length of the window), shift(step size between different windows), and stride (step size within each window).
  • Output: A list of lists or 1D Numpy arrays of real numbers.
  • Implementation: Implemented using Python, its standard library, and Numpy.
Cross-Correlation
  • Signature: convolution2d(input_matrix: np.ndarray, kernel: np.ndarray, stride: int = 1) -> np.ndarray
  • Input: 2D Numpy arrays representing an input matrix and a kernel, along with a stride parameter.
  • Output: A 2D Numpy array of real numbers.
  • Implementation: Implemented using Python, its standard library, and Numpy.

Structure

  • functions.py: contains the main three functions (transpose2d, window1d, convolution2d).
  • validate.py: contains functions to check if the inputs for the functions in functions.py are coorect.

Installation

You can install the library using pip:

pip install data-transformation-library

Usage

To use the functions you have to install library and import the functions.

Example usage:

import numpy as np
from functions import transpose2d, window1d, convolution2d

# Transpose:
input_matrix = [[3, 7, 9], [1, 5, 8]]
print(transpose2d(input_matrix))
# Output
[[3, 1], [7, 5], [9, 8]]


# Time Series Windowing:
input_array = [1, 2, 3, 4, 5, 6, 7, 8, 9]
print(window1d(input_array, size=3, shift=2, stride=1))
# Output
[[1, 2, 3], [3, 4, 5], [5, 6, 7], [7, 8, 9]]


# Cross-Correlation:
input_matrix = np.array([[1, 2, 3],
                          [4, 5, 6],
                          [7, 8, 9]])
kernel = np.array([[1, 0, -1],
                   [1, 0, -1],
                   [1, 0, -1]])
print(convolution2d(input_matrix, kernel, stride=1))
# Output
[[-6.]]

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

data_transformation_library_ingri-0.1.1.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

File details

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

File metadata

File hashes

Hashes for data_transformation_library_ingri-0.1.1.tar.gz
Algorithm Hash digest
SHA256 65e257999d9fe1c73df98765e9de1f74890d8ec67a817ff3be007e04b68979c1
MD5 a706958d899a437fc6f9fde63dd1b9ea
BLAKE2b-256 a19fc0fd39bde806fd0af299efee4e1a4363a00c1464d107c52e82850b47008c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for data_transformation_library_ingri-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 99f0d7df8dec102c89fc22358b51e6cb779b2e6a34ce7e99c05e6149dcb37c88
MD5 e0d5c54a447bf2626165da79d978cc69
BLAKE2b-256 6afc03cf9fa508752579e4eec681a38578a5696619c9963f40d78ef6b8940cb9

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