Skip to main content

No project description provided

Project description

Data Transformations Library

This library provides essential functions for manipulating and transforming data structures commonly used in data science and machine learning.

Table of Contents

Installation

Clone the repository

git clone git@github.com:TuringCollegeSubmissions/smizak-DE2.1.git

Navigate to the directory

cd smizak-DE2.1

Install necessary packages

pip install -r requirements.txt

Functions

transpose2d

Transposes a 2D matrix.

Usage:

from src.DataTransformationsLibrary import transpose2d
result = transpose2d(input_matrix)

Arguments:

  • input_matrix (list[list[float]]): A 2D matrix to transpose.

Returns:

  • A list representing the transposed matrix.

Raises:

  • ValueError: If the input matrix is empty.
  • ValueError: If all rows of the matrix do not have the same length.

window1d

Generates windows of the specified size, shift, and stride from the input array.

Usage:

from src.DataTransformationsLibrary import window1d
result = window1d(input_array, size, shift=1, stride=1)

Arguments:

  • input_array (Union[list, np.ndarray]): 1D list or numpy array to generate windows from.
  • size (int): The size of each window.
  • shift (int, optional): Number of positions to move the window each iteration. Defaults to 1.
  • stride (int, optional): The step between consecutive elements within each window. Defaults to 1.

Returns:

  • A list of windows.

Raises:

  • ValueError: If input_array is not a list or 1D numpy array.
  • ValueError: If input_array is not 1D.

convolution2d

Performs a 2D convolution operation on the input matrix with a specified kernel.

Usage:

from src.DataTransformationsLibrary import convolution2d
result = convolution2d(input_matrix, kernel, stride=1)

Arguments:

  • input_matrix (np.ndarray): A 2D input matrix for convolution.
  • kernel (np.ndarray): A 2D kernel for convolution.
  • stride (int, optional): The step size to use when applying the kernel. Defaults to 1.

Returns:

  • A matrix resulting from the convolution operation.

Raises:

  • ValueError: If stride is less than or equal to 0.

Running Tests

To ensure the integrity of this library, a comprehensive set of tests are provided. To run the tests:

Ensure pytest is installed

pip install pytest

Navigate to the tests directory

# Navigate to tests directory
cd test

# Run the tests
pytest

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

datatransformationslibrary-0.1.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

datatransformationslibrary-0.1.0-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file datatransformationslibrary-0.1.0.tar.gz.

File metadata

  • Download URL: datatransformationslibrary-0.1.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.9.2 Darwin/22.2.0

File hashes

Hashes for datatransformationslibrary-0.1.0.tar.gz
Algorithm Hash digest
SHA256 58898396e593110eb47d8f405a89a89265094e3d83466ce8ada270b47c248870
MD5 4b634deaea87ff8b5dec7a51db337f48
BLAKE2b-256 0568cc0ea8bee3f0206fa04024caf14a1c10ce13a00808b2c2a00616ff75e173

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for datatransformationslibrary-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 56b6f532e6a12c83ac38ff88f15a5c0d9d726024b3cf8f62a0236c54bca65071
MD5 b2fa68b16d35e38e210adae2a1dc8011
BLAKE2b-256 dfa52da9100105c62d1b9cbf9c1ccacbce44dddc202d7711a3a9781b32dc029b

See more details on using hashes here.

Supported by

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