Connection
Base URL, credentials and a reachable server.
Review gini_fraction.py as a defined concentration calculation, keeping interpretation outside the arithmetic.
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.
from fractions import Fraction
def gini_fraction(values):
if type(values) is not list or not 1 <= len(values) <= 4096 or any(type(x) is not int or not 0 <= x <= 10**9 for x in values):
raise ValueError("gini.values")
total, n = sum(values), len(values)
if total == 0:
return Fraction(0, 1)
numerator = sum((2*i-n-1)*value for i, value in enumerate(sorted(values), 1))
return Fraction(numerator, n*total)