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

Function _mean_standard_deviation

modAL/dropout.py:297–318  ·  view source on GitHub ↗

Calculates the mean of the per class calculated standard deviations. 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

(proba: list)

Source from the content-addressed store, hash-verified

295
296
297def _mean_standard_deviation(proba: list) -> np.ndarray:
298 """
299 Calculates the mean of the per class calculated standard deviations.
300
301 As it is explicitly formulated in:
302 Deep Bayesian Active Learning with Image Data.
303 (Yarin Gal, Riashat Islam, and Zoubin Ghahramani. 2017.)
304
305 Args:
306 proba: list with the predictions over the dropout cycles
307 mask: mask to detect the padded classes (must be of same shape as elements in proba)
308 Return:
309 Returns the mean standard deviation of the dropout cycles over all classes.
310 """
311
312 proba_stacked = np.stack(proba, axis=len(proba[0].shape))
313
314 standard_deviation_class_vise = np.std(proba_stacked, axis=-1)
315 mean_standard_deviation = np.mean(standard_deviation_class_vise, where=~np.isnan(
316 standard_deviation_class_vise), axis=-1)
317
318 return mean_standard_deviation
319
320
321def _entropy(proba: list) -> np.ndarray:

Callers 1

mc_dropout_mean_stFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…