RandomDropout#
- class RandomDropout(dropout_ratio=0.2, dropout_application_ratio=0.5)[source]#
Bases:
objectRandomly drop a fraction of points from the sample.
With probability
dropout_application_ratiofor the whole sample, keeps a uniformly random1 - dropout_ratiofraction of points and removes the rest viaindex_operator(so every per-point key inindex_valid_keysis subsampled together). Ifsampled_indexis present (data-efficient setups), the labeled points are forced into the kept set andsampled_indexis remapped to the new indexing. Requirescoord(andsegment/sampled_indexwhen those are present). Registered asRandomDropout– use this string as thetypein atransform=[...]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)