jit_scorers
- corsort.jit_scorers.jit_scorer_delta(n, downs, ups)[source]
Estimates scores of nodes by the difference between the numbers of descendants and ascendants. The rational is to consider that an item should be in average halfway between its highest and lowest possible values.
- Parameters:
- Returns:
An array that represents, for each new performed comparison, some item scores that estimate the final position of items.
- Return type:
Examples
>>> my_n = 5 >>> my_downs = np.array([0, 1, 2]) >>> my_ups = np.array([2, 2, 3]) >>> jit_scorer_delta(my_n, my_downs, my_ups) array([[ 0, 0, 0, 0, 0], [-1, 0, 1, 0, 0], [-1, -1, 2, 0, 0], [-2, -2, 1, 3, 0]])
- corsort.jit_scorers.jit_scorer_rho(n, downs, ups)[source]
Estimates scores of nodes by dividing the number of the descendants by the size of the family plus one. The rational is to consider that the family should be in average evenly spaced in the sorted result.
- Parameters:
- Returns:
An array that represents, for each new performed comparison, some item scores that estimate the final position of items.
- Return type:
Examples
>>> my_n = 5 >>> my_downs = np.array([0, 1, 2]) >>> my_ups = np.array([2, 2, 3]) >>> jit_scorer_rho(my_n, my_downs, my_ups) array([[0.5 , 0.5 , 0.5 , 0.5 , 0.5 ], [0.33333333, 0.5 , 0.66666667, 0.5 , 0.5 ], [0.33333333, 0.33333333, 0.75 , 0.5 , 0.5 ], [0.25 , 0.25 , 0.6 , 0.8 , 0.5 ]])