if ``cat_sample_indices`` is a ``dict``, then the call to ``.keys()`` here duplicates effort