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

Install from pypi

Alternatively one can install the package from version published on pypi. package can be found on https://pypi.org/project/datatransformationslibrary/

pip install datatransformationslibrary

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.2.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: datatransformationslibrary-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 8ea5669c24540094b731f5c3883a707b41f0c99ac138b4e2a2882fe719a125c0
MD5 75482c72680252680dc3fc9211e3ed4a
BLAKE2b-256 68f847043a70c7cc8e91cd6a19daf3b898932a3d20b02f7800b4ab60b98828f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for datatransformationslibrary-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3f36a45022f62e6e982df9717d6642bd34e3a55c0d4b4929134656a86c1e307f
MD5 4276a46bfdc8419a68547bedcd815937
BLAKE2b-256 7b4a582601de1c85ed90e449eabfdd72c7ccfbe713a0a7ebb129b9637ccb173b

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