bradley_terry_tree

heterogeneity.bradley_terry_tree(matrix, method_names, dataset_names, numeric_features=None, categorical_features=None, polarity='higher_is_better', minsize=5, alpha=0.05)

Fit a Bradley-Terry tree on per-dataset paired method comparisons.

Parameters

Name Type Description Default
matrix np.ndarray Array of shape (n_methods, n_datasets) holding one metric’s scores. required
method_names Sequence[str] Length n_methods row labels, the objects compared. required
dataset_names Sequence[str] Length n_datasets column labels, the subjects whose features split the tree. required
numeric_features dict[str, Sequence[float]] | None Maps from feature name to a length n_datasets sequence of values, the candidate splitting variables. At least one feature across the two maps is required. None
categorical_features dict[str, Sequence[float]] | None Maps from feature name to a length n_datasets sequence of values, the candidate splitting variables. At least one feature across the two maps is required. None
polarity str "higher_is_better" or "lower_is_better", the metric direction used to orient the pairwise comparisons. 'higher_is_better'
minsize int Minimal number of datasets in a node; the tree will not create a leaf smaller than this. 5
alpha float Significance level for the parameter-stability split test. 0.05

Returns

Type Description
BradleyTerryTreeReport

Raises

Type Description
ValueError For shape, length, polarity, or empty-feature problems.
RNotAvailableError If the R toolchain with psychotree is not available.
RExecutionError If the R subprocess fails.