Utils¶
benchbench.utils.base¶
- benchbench.utils.base.get_combinations(s, k)[source]¶
Generate all subsets of size k from set s.
- Parameters:
s (list) – List of elements to get combinations from.
k (int) – Size of each combination.
- Returns:
A list of combinations, where each combination is represented as a list.
- Return type:
list
- benchbench.utils.base.is_int(x)[source]¶
Check if a string can be converted to an integer.
- Parameters:
x (str) – Input string.
- Returns:
True if x can be converted to an integer, False otherwise
- Return type:
bool
benchbench.utils.metric¶
- benchbench.utils.metric.get_kendall_tau(new_rank, old_rank)[source]¶
Calculate Kendall’s Tau for two rankings.
- Parameters:
new_rank (np.array) – new ranking
old_rank (np.array) – old ranking
- Returns:
float: Kendall’s Tau float: p-value
- Return type:
tuple
- benchbench.utils.metric.get_kendall_w(rankings)[source]¶
Calculate Kendall’s W for a list of rankings.
- Parameters:
rankings (list) – a list of rankings
- Returns:
Kendall’s W
- Return type:
float
- benchbench.utils.metric.get_order_diff(new_order, old_order=None)[source]¶
[Legacy code] Get the difference between two orders.
- benchbench.utils.metric.get_order_variance(all_new_order)[source]¶
[Legacy code] Get the variance of all orders.
- benchbench.utils.metric.get_rank_diff(new_rank, old_rank=None)[source]¶
Get the difference between two ranks.
- Parameters:
new_rank (np.array) – new ranking
old_rank (np.array) – old ranking
- Returns:
Kendall’s Tau float: MRC (max rank change)
- Return type:
float