Skip to main content

Python Matrix and Array Manipulations Library

This Python library, developed as a proof of concept (POC) at a large software company, provides essential data transformation functionalities for data scientists. The library includes operations for matrix transposition, time series windowing, and 2D convolution, all crucial for preparing data used in machine learning models.

Overview

You are working as a data engineer tasked with building this library to aid in data transformation tasks commonly encountered in data science workflows. This document details the initial sprint of the library, which involves the development of three key functions.

Features

  1. Matrix Transposition

    • Function: transpose2d(input_matrix)
    • Description: This function transposes a 2D matrix (2d tensor), an essentialoperation in data science for reorienting data.
    • Usage: Transpose the axes of a matrix to rearrange data, making it suitablefor various algorithms that require specific data orientations.
    • Learn More: numpy.transpose
  2. Time Series Windowing

    • Function: window1d(input_array, size, shift=1, stride=1)
    • Description: Generates sliding windows from a 1D list or numpy.ndarray, - valuable for time series analysis and modeling.
    • Usage: Extract features or patterns from time series data by analyzing - segments of the dataset.
    • Learn More: tf.data.Dataset.window
  3. 2D Convolution (Cross-Correlation)

    • Function: convolution2d(input_matrix, kernel, stride=1)
    • Description: Performs a 2D convolution operation (technically - cross-correlation), a cornerstone in neural network architectures like CNNs.
    • Usage: Apply filters to images or other two-dimensional data to extract - features or apply effects.
    • Learn More: torch.nn.functional.conv2d

Installation

To use this library, install it via pip:

pip install autalac-de2v2-1-5

Usage

Here are some examples of how to use the functions in this library:

import numpy as np
from autalac-de2v2-1-5 import transpose2d, window1d, convolution2d

# Transposes a 2D matrix.
input_matrix_t2d = [
    [1.0, 2.0, 3.0],
    [4.0, 5.0, 6.0],
    [7.0, 8.0, 9.0]
]

transposed = transpose2d(input_matrix_t2d)
print("\nOriginal matrix:")
for row in input_matrix_t2d:
    print(row)
print("Transposed matrix:")
for row in transposed:
    print(row)

# Generates sliding windows from a 1D list or numpy.ndarray.
input_list_w1d = [11, 52, 63, 42, 5, 64, 79, 8, 29, 10]
print("\nList input example:")
for window in window1d(input_list_w1d, size=3, shift=3, stride=1):
    print(window)

input_array_w1d = np.arange(1, 15)
print("Numpy array input example:")
for window in window1d(input_array_w1d, size=4, shift=4, stride=1):
    print(window)


#     Performs a 2D convolution (actually cross-correlation) operation on a 2D input matrix with a given kernel.
input_matrix_2d_con = np.array([
    [1, 6, 2],
    [5, 3, 1],
    [7, 0, 4]
])

kernel_2d_con = np.array([
    [1, 2],
    [-1, 0]
])
print("\nFunction convolution2d input_matrix")
for row3 in input_matrix_2d_con:
    print(row3)
print("Function convolution2d kernel")
for row4 in kernel_2d_con:
    print(row4)
output_matrix = convolution2d(input_matrix_2d_con, kernel_2d_con, stride=1)
print("Function convolution2d example")
for row5 in output_matrix:
    print(row5)

Metadata

Release files for autalac_de2v2 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for autalac_de2v2 0.1.0
File Size Uploaded
autalac_de2v2-0.1.0.tar.gz 3.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for autalac_de2v2 0.1.0
File Interpreter ABI Platform
autalac_de2v2-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.8 kB

Release files / autalac_de2v2-0.1.0.tar.gz

Download URL autalac_de2v2-0.1.0.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
725edeca66e656b8cd97afe7ba2e8ae4398df83a9b71687b96e582396809f8b0
BLAKE2b-256 checksum
How to use checksums
fc5351149c689418317c665541eddd4292e3455288c8cd841d4d8f7006ff7b88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.11.7 Windows/10

Release files / autalac_de2v2-0.1.0-py3-none-any.whl

Download URL autalac_de2v2-0.1.0-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0bcd50813c57f40d16f0502ba478c8e6b42a4cb45a04c04799ed3bd1e95b2a1a
BLAKE2b-256 checksum
How to use checksums
e54cf11c842854bdac48eab1605783e6a6274b625c52c3e73cf2c10b41a75c00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.11.7 Windows/10

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page