Connection
Base URL, credentials and a reachable server.
Use median_deviation.py to distinguish a robust unscaled spread estimate from variance or a normal-distribution correction.
Base URL, credentials and a reachable server.
A model available through the configured endpoint.
Context limits and tool support are determined by the model and server.
import math
def median_deviation(values):
if type(values) is not list or not 1 <= len(values) <= 4096:
raise ValueError("mad.input")
if any(type(x) not in (int, float) or not -10**100 <= x <= 10**100 or not math.isfinite(x) for x in values):
raise ValueError("mad.value")
def median(items):
ordered = sorted(items)
n = len(ordered)
return float(ordered[n//2]) if n % 2 else ordered[n//2-1]/2+ordered[n//2]/2
center = median(values)
return center, median([abs(x-center) for x in values])