ShufflePoint#

class ShufflePoint[source]#

Bases: object

Randomly permute the point ordering of the sample.

Generates a random permutation of the point indices and reorders every per-point key in index_valid_keys together via index_operator, so point-aligned arrays stay consistent. The point count is unchanged. Requires coord (asserted). Registered as ShufflePoint – use this string as the type in a transform=[...] config list.

Note

Takes no constructor arguments. Removes any incidental ordering bias before models or pooling that could be order-sensitive.

Example

>>> import numpy as np
>>> from pimm.datasets.transform import ShufflePoint
>>> np.random.seed(0)
>>> data = {"coord": np.array([[0., 0., 0.], [1., 1., 1.], [2., 2., 2.]], dtype="f4"),
...         "energy": np.array([[10.], [20.], [30.]], dtype="f4")}
>>> out = ShufflePoint()(data)
>>> len(out["coord"])  # same points, reordered (coord and energy together)
3
>>> sorted(out["energy"].ravel().tolist())  # the set of values is preserved
[10.0, 20.0, 30.0]