code: def gini(y_true, y_pred, sample_weight=None):
      sort_indices = np.argsort(y_pred)
      if sample_weight is not None:
          sample_weight = sample_weight[sort_indices]
      else:
          sample_weight = np.ones_like(y_true)
      y_true = y_true[sort_indices]
      random = (sample_weight / sample_weight.sum()).cumsum()
      lorentz = y_true.cumsum() / y_true.sum()
      return (
          1
          - (
              (random[1:] - random[:-1]) * (lorentz[1:] + lorentz[:-1])
          ).sum()
      )
  
file_path: poutyne/tests/framework/metrics/test_sklearn_metrics.py
imports: from itertools import repeat
  from unittest import TestCase, skipIf
  import numpy
  import torch
  from torch.utils.data import DataLoader
  from poutyne import SKLearnMetrics, TensorDataset
label_desc: Use image node_id 1 for calling a global function with example usage: gini(y_true, y_pred, sample_weight) and returns: unknown