Skip to content

Commit 536636c

Browse files
committed
Merge branch 'zhangyu94-fix-batch-select-instance' into dev
2 parents 452898f + f8778f5 commit 536636c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

modAL/batch.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@ def select_instance(
101101
scores = alpha * (1 - similarity_scores) + (1 - alpha) * X_uncertainty[mask]
102102

103103
# Isolate and return our best instance for labeling as the one with the largest score.
104-
best_instance_index = np.argmax(scores)
104+
best_instance_index_in_unlabeled = np.argmax(scores)
105+
n_pool, _ = X_pool.shape
106+
unlabeled_indices = [i for i in range(n_pool) if mask[i]]
107+
best_instance_index = unlabeled_indices[best_instance_index_in_unlabeled]
105108
mask[best_instance_index] = 0
106109
return best_instance_index, X_pool[best_instance_index].reshape(1, -1), mask
107110

0 commit comments

Comments
 (0)