MCPcopy Create free account
hub / github.com/cure-lab/deep-active-learning / query

Method query

query_strategies/margin_sampling.py:9–14  ·  view source on GitHub ↗
(self, n)

Source from the content-addressed store, hash-verified

7 super(MarginSampling, self).__init__(X, Y, X_te, Y_te, idxs_lb, net, handler, args)
8
9 def query(self, n):
10 idxs_unlabeled = np.arange(self.n_pool)[~self.idxs_lb]
11 probs = self.predict_prob(self.X[idxs_unlabeled], self.Y.numpy()[idxs_unlabeled])
12 probs_sorted, idxs = probs.sort(descending=True)
13 U = probs_sorted[:, 0] - probs_sorted[:,1]
14 return idxs_unlabeled[U.sort()[1].numpy()[:n]]

Callers

nothing calls this directly

Calls 1

predict_probMethod · 0.45

Tested by

no test coverage detected