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 hashes)

Uploaded Source

Built Distribution

Supported by

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