blocks.utils.tf¶
Functions¶
get_balancing_weights(): Compute weights balancing zeros and ones in the given masks tensor.
-
blocks.utils.tf.get_balancing_weights(masks, correction=0.001)[source]¶ Compute weights balancing zeros and ones in the given masks tensor.
Warning
The masks tensor must be binary - i.e., contain only ones and zeros!
- Parameters
masks (
Tensor) – zero/one masks to be balancedcorrection (
float) – correction parameter to avoid divergence of weights
- Return type
Tensor- Returns
weights balancing the given mask (having the same shape)