RandomDropout#

class RandomDropout(dropout_ratio=0.2, dropout_application_ratio=0.5)[source]#

Bases: object

Randomly drop a fraction of points from the sample.

With probability dropout_application_ratio for the whole sample, keeps a uniformly random 1 - dropout_ratio fraction of points and removes the rest via index_operator (so every per-point key in index_valid_keys is subsampled together). If sampled_index is present (data-efficient setups), the labeled points are forced into the kept set and sampled_index is remapped to the new indexing. Requires coord (and segment/sampled_index when those are present). Registered as RandomDropout – use this string as the type in a transform=[...] config list.

Parameters:
  • dropout_ratio (float) – fraction of points to drop when the transform fires. Defaults to 0.2.

  • dropout_application_ratio (float) – probability of applying dropout to a given sample. Defaults to 0.5.

Note

Point selection is random and unaffected by spatial structure; this reduces the point count, so it must run before length-sensitive steps.

Example

>>> import numpy as np
>>> from pimm.datasets.transform import RandomDropout
>>> np.random.seed(0)
>>> data = {"coord": np.arange(30, dtype="f4").reshape(10, 3),
...         "energy": np.arange(10, dtype="f4").reshape(10, 1)}
>>> # application_ratio=1.0 always fires; drops 40%, keeping coord and energy aligned
>>> out = RandomDropout(dropout_ratio=0.4, dropout_application_ratio=1.0)(data)
>>> len(out["coord"]), len(out["energy"])  # 10 -> int(10 * 0.6) = 6 points
(6, 6)