Calculates the variation ratios over dropout cycles As it is explicitly formulated in: Deep Bayesian Active Learning with Image Data. (Yarin Gal, Riashat Islam, and Zoubin Ghahramani. 2017.) Args: proba: list with the predictions over
(proba: list)
| 343 | |
| 344 | |
| 345 | def _variation_ratios(proba: list) -> np.ndarray: |
| 346 | """ |
| 347 | Calculates the variation ratios over dropout cycles |
| 348 | |
| 349 | As it is explicitly formulated in: |
| 350 | Deep Bayesian Active Learning with Image Data. |
| 351 | (Yarin Gal, Riashat Islam, and Zoubin Ghahramani. 2017.) |
| 352 | |
| 353 | Args: |
| 354 | proba: list with the predictions over the dropout cycles |
| 355 | mask: mask to detect the padded classes (must be of same shape as elements in proba) |
| 356 | Return: |
| 357 | Returns the variation ratios of the dropout cycles. |
| 358 | """ |
| 359 | proba_stacked = np.stack(proba, axis=len(proba[0].shape)) |
| 360 | |
| 361 | # Calculate the variation ratios over the mean of dropout cycles |
| 362 | valuesDCMean = np.mean(proba_stacked, axis=-1) |
| 363 | return 1 - np.amax(valuesDCMean, initial=0, where=~np.isnan(valuesDCMean), axis=-1) |
| 364 | |
| 365 | |
| 366 | def _bald_divergence(proba: list) -> np.ndarray: |
no outgoing calls
no test coverage detected
searching dependent graphs…