BBinOriole
Product

Product features · Histogram edge ownership

01

Use histogram.py to verify which bin owns an observation exactly equal to an internal or final edge.

01

Connection

Base URL, credentials and a reachable server.

02

Selection

A model available through the configured endpoint.

03

Capabilities

Context limits and tool support are determined by the model and server.

Histogram edge ownership

● ● ●BinOriole●
A concrete starting point · Histogram edge ownership ×
import bisect, math

def histogram(edges, values):
    if type(edges) is not list or type(values) is not list or not 2 <= len(edges) <= 257 or len(values) > 4096:
        raise ValueError("bins.shape")
    if any(type(x) not in (int, float) or not -10**100 <= x <= 10**100 or not math.isfinite(x) for x in edges+values):
        raise ValueError("bins.value")
    if any(a >= b for a, b in zip(edges, edges[1:])):
        raise ValueError("bins.edges")
    counts, under, over = [0]*(len(edges)-1), 0, 0
    for value in values:
        if value < edges[0]:
            under += 1
        elif value > edges[-1]:
            over += 1
        else:
            counts[min(bisect.bisect_right(edges, value)-1, len(counts)-1)] += 1
    return counts, under, over
✳Histogram edge ownership
✓ ChangesReview before applying ↗
Illustrative workspace
AI coding workspace

Your next change starts here.

Get the Windows app ↗