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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: datatransformationslibrary-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 035d8abbf9d37186d6ae278c8a1be05d3dcc9b646d06871d18f9ab83c2c6f653
MD5 ab20172b9a658dd4cba66659dc1aa732
BLAKE2b-256 bd1d85ff31293ecf706fe766619647f8287d58c1fde6071a006c67547d2206b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for datatransformationslibrary-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e6e357b9ac00fc210e9e860849251d6cf1131f1a458b1ab85a470b33ca067d3e
MD5 6508380f3e608a9f9474b88cad477bf4
BLAKE2b-256 391e5d6880a80e0e6113be3a619e8e7e0020c3d0d1210f2a54b8deb71fec6349

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