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 corect.

Installation

You can install the library using pip:

pip install data-transformation-library-ingri==0.1.1

Usage

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

Example usage:

from  data_transformation_library_ingri import functions
import numpy as np

# Transpose:
input_matrix = [[3, 7, 9], [1, 5, 8]]
print(functions.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(functions.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(functions.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.2.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.2.tar.gz.

File metadata

File hashes

Hashes for data_transformation_library_ingri-0.1.2.tar.gz
Algorithm Hash digest
SHA256 994ae112b9e81dfe7c55cf5db0afb9adc75ff6b9301f5dd0f27efe1127e1a016
MD5 408f20812e3ded58a68788d326062ea8
BLAKE2b-256 f51d19858fe27f1aae05dd4500b4afa7b9af9cf9b8c2801ff36375d5be1ba8f6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for data_transformation_library_ingri-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 40a214bd55ae9a1b53d8e1663347158fa14f63c95a0d02b06c1c16e91be5c5c4
MD5 2b7206ab4c158b24d41fa38b54ec46c5
BLAKE2b-256 bad0916370646bab3967c36bcf04f452a1360f6da9d22e4335d906b76d8bb7c4

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