Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct best_instance_index in batch.select_instance #29

Merged
merged 1 commit into from
Jan 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion modAL/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down