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

Function max_entropy

examples/cost_effective_active_learning.py:48–64  ·  view source on GitHub ↗
(active_learner, X, K=16, N=16)

Source from the content-addressed store, hash-verified

46
47
48def max_entropy(active_learner, X, K=16, N=16):
49
50 class_prob = active_learner.predict_proba(X)
51 entropy = entr(class_prob).sum(axis=1)
52 uncertain_idx = np.argpartition(entropy, -K)[-K:]
53
54 """
55 Original Implementation -- Pick most confident samples with
56 entropy less than a threshold. Threshold is decayed in every
57 iteration.
58
59 Different than original -- Pick top n most confident samples.
60 """
61
62 confidence_idx = np.argpartition(entropy, N)[:N]
63
64 return np.concatenate((uncertain_idx, confidence_idx), axis=0)
65
66
67active_learner = ActiveLearner(

Callers

nothing calls this directly

Calls 1

predict_probaMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…