(self, weights)
| 479 | self.log_stats = log_stats |
| 480 | |
| 481 | def _normalize_probabilities(self, weights): |
| 482 | if len(weights) == 0: |
| 483 | return weights |
| 484 | weights = np.array(weights) |
| 485 | if np.any(weights < 0): |
| 486 | raise ValueError(f"Probabilities must be greater than or equal to zero, got {weights}.") |
| 487 | if np.all(weights == 0): |
| 488 | raise ValueError(f"At least one probability must be greater than zero, got {weights}.") |
| 489 | weights = weights / weights.sum() |
| 490 | return list(weights) |
| 491 | |
| 492 | def flatten(self): |
| 493 | transforms = [] |