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.

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.0.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.0.tar.gz.

File metadata

File hashes

Hashes for data_transformation_library_ingri-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b01dc94d118341c05f8c806f8996c98cd61b32555032dd7e64b139f0ed92372c
MD5 9271f93de1b829aed26f102a412b6ae2
BLAKE2b-256 935b178c7234f9d19392adee75c1908dbdfe6a43df5bc19f52eebb4d244ca144

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for data_transformation_library_ingri-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 95424c8344035f9b1171729d224721ff73e291dc33d5e3819986ec69da1e4d6f
MD5 2e0ee4c043d8366ff8928232c276404b
BLAKE2b-256 cc4bd469479070ab8733e1a304b5a2e636589431747c05a3afab251ab4f3b90f

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