or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/cupy-cuda101@9.6.x
tile.json

tessl/pypi-cupy-cuda101

tessl install tessl/pypi-cupy-cuda101@9.6.0

CuPy: NumPy & SciPy for GPU (CUDA 10.1 version)

Agent Success

Agent success rate when using this tile

87%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.19x

Baseline

Agent success rate without this tile

73%

task.mdevals/scenario-1/

Data Distribution Analyzer

Build a data distribution analysis toolkit that computes histograms and statistics for various types of numerical data.

Requirements

Core Functionality

Implement a function analyze_distribution that takes numerical data as input and returns histogram information:

  • Accept a 1D array of numerical values
  • Compute a histogram with a specified number of bins
  • Return both the histogram counts and bin edges
  • Handle edge cases like empty arrays appropriately

Multi-Dimensional Analysis

Implement a function analyze_2d_distribution that analyzes the joint distribution of two variables:

  • Accept two 1D arrays of equal length representing x and y coordinates
  • Compute a 2D histogram with specified bins for each dimension
  • Return the 2D histogram counts and bin edges for both dimensions

Bin Assignment

Implement a function assign_to_bins that assigns data points to histogram bins:

  • Accept a 1D array of numerical values and an array of bin edges
  • Return the bin indices for each data point
  • Values outside the bin range should be handled according to standard histogram behavior

Frequency Counting

Implement a function count_occurrences that counts the frequency of integer values:

  • Accept a 1D array of non-negative integers
  • Return an array where index i contains the count of value i in the input
  • Optionally specify the length of the output array

Test Cases

  • Given an array [1.5, 2.3, 2.8, 3.1, 3.9, 4.2], computing a histogram with 3 bins returns counts and edges that correctly partition the data @test
  • Given two arrays representing x and y coordinates, the 2D histogram correctly counts points in each grid cell @test
  • Given values [1.5, 2.5, 3.5] and bin edges [0, 2, 4], bin assignment returns indices [0, 1, 1] @test
  • Given an integer array [0, 1, 1, 2, 2, 2], counting occurrences returns [1, 2, 3] @test

Implementation

@generates

API

def analyze_distribution(data, bins=10):
    """
    Compute histogram of 1D data.

    Args:
        data: 1D array of numerical values
        bins: Number of equal-width bins (default: 10)

    Returns:
        tuple: (counts, bin_edges) where counts is the histogram and bin_edges defines the bins
    """
    pass

def analyze_2d_distribution(x_data, y_data, bins=10):
    """
    Compute 2D histogram of paired data.

    Args:
        x_data: 1D array of x coordinates
        y_data: 1D array of y coordinates
        bins: Number of bins for each dimension, can be int or tuple of ints

    Returns:
        tuple: (counts_2d, x_edges, y_edges) where counts_2d is the 2D histogram
    """
    pass

def assign_to_bins(data, bin_edges):
    """
    Determine which bin each value belongs to.

    Args:
        data: 1D array of numerical values
        bin_edges: Array defining bin boundaries

    Returns:
        array: Bin indices for each data point
    """
    pass

def count_occurrences(data, minlength=None):
    """
    Count frequency of non-negative integer values.

    Args:
        data: 1D array of non-negative integers
        minlength: Minimum length of output array (optional)

    Returns:
        array: Frequency count where index i contains count of value i
    """
    pass

Dependencies { .dependencies }

cupy { .dependency }

Provides GPU-accelerated array computing with histogram functionality.