From f8778f545b083a9eee63b9c97479e9e296e6d753 Mon Sep 17 00:00:00 2001 From: Yu Zhang Date: Fri, 11 Jan 2019 17:50:46 +0000 Subject: [PATCH] fix: correct best_instance_index in batch.select_instance --- modAL/batch.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modAL/batch.py b/modAL/batch.py index be931bc..4c00d5c 100644 --- a/modAL/batch.py +++ b/modAL/batch.py @@ -101,7 +101,10 @@ def select_instance( scores = alpha * (1 - similarity_scores) + (1 - alpha) * X_uncertainty[mask] # Isolate and return our best instance for labeling as the one with the largest score. - best_instance_index = np.argmax(scores) + best_instance_index_in_unlabeled = np.argmax(scores) + n_pool, _ = X_pool.shape + unlabeled_indices = [i for i in range(n_pool) if mask[i]] + best_instance_index = unlabeled_indices[best_instance_index_in_unlabeled] mask[best_instance_index] = 0 return best_instance_index, X_pool[best_instance_index].reshape(1, -1), mask