[Python] How to shuffle inner dimensions /axis of an array without disturbing the internal...

Discussão em 'Python' iniciado por Stack, Agosto 1, 2025.

  1. Stack

    Stack Membro Participativo

    It seems like the standard numpy.random.shuffle function shuffles (in place) only the first dimension / axis. I want a similar functionality for inner dimensions.

    Note that numpy.random.default_rng().permuted(axis) works on any axis, but distorts the data i.e., mixes data from multiple rows. This can be problematic for example machine learning tasks, where you want to preserve the data but only shuffle the rows.

    Continue reading...

Compartilhe esta Página