MCPcopy Create free account
hub / github.com/modAL-python/modAL / _variation_ratios

Function _variation_ratios

modAL/dropout.py:345–363  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

343
344
345def _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
366def _bald_divergence(proba: list) -> np.ndarray:

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…