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

Function _entropy

modAL/dropout.py:321–342  ·  view source on GitHub ↗

Calculates the entropy per class 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 ove

(proba: list)

Source from the content-addressed store, hash-verified

319
320
321def _entropy(proba: list) -> np.ndarray:
322 """
323 Calculates the entropy per class over dropout cycles
324
325 As it is explicitly formulated in:
326 Deep Bayesian Active Learning with Image Data.
327 (Yarin Gal, Riashat Islam, and Zoubin Ghahramani. 2017.)
328
329 Args:
330 proba: list with the predictions over the dropout cycles
331 mask: mask to detect the padded classes (must be of same shape as elements in proba)
332 Return:
333 Returns the entropy of the dropout cycles over all classes.
334 """
335
336 proba_stacked = np.stack(proba, axis=len(proba[0].shape))
337
338 # calculate entropy per class and sum along dropout cycles
339 entropy_classes = entropy_sum(proba_stacked, axis=-1)
340 entropy = np.mean(entropy_classes, where=~
341 np.isnan(entropy_classes), axis=-1)
342 return entropy
343
344
345def _variation_ratios(proba: list) -> np.ndarray:

Callers 1

mc_dropout_max_entropyFunction · 0.85

Calls 1

entropy_sumFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…