peal.visualization.model_comparison.change_all

peal.visualization.model_comparison.change_all(x, target_index, current_index)[source]

Build the indicator tensor of one criterion over all criterion combos.

Recursively descends the 2 x 2 x ... x 2 tensor x; at depth target_index the first half is set to 0 and the second to 1, so the result marks which combinations have criterion target_index true.

Parameters:
  • x (torch.Tensor) – Tensor of shape [2] * n_criteria (values ignored, shape used).

  • target_index (int) – Axis (criterion) whose indicator is built.

  • current_index (int) – Current recursion depth; start with 0.

Returns:

Same shape as x, 1 where axis target_index has index 1.

Return type:

torch.Tensor