Gini
unknown
python
2 years ago
157 B
5
Indexable
def gini(x): total = 0 for i, xi in enumerate(x[:-1], 1): total += np.sum(np.abs(xi - x[i:])) return total / (len(x)**2 * np.mean(x))
Editor is loading...
def gini(x): total = 0 for i, xi in enumerate(x[:-1], 1): total += np.sum(np.abs(xi - x[i:])) return total / (len(x)**2 * np.mean(x))