Skip to content

Commit 1c46ee1

Browse files
committed
Removed indices val from self-labeling step.
1 parent 48ff042 commit 1c46ee1

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

neural_structured_learning/research/gam/data/dataset.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ def __init__(self, dataset, keep_label_proportions=False, inductive=False):
322322
if not self.inductive:
323323
self.dataset.indices_unlabeled = np.concatenate(
324324
(dataset.indices_unlabeled,
325+
dataset.indices_val,
325326
dataset.indices_test))
326327

327328
# If when labeling new data we want to keep the proportions of the labels

neural_structured_learning/research/gam/trainer/trainer_cotrain.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,12 @@ def _select_samples_to_label(self, data, trainer_cls, session):
345345
assign to each of the selected nodes.
346346
"""
347347
# Select the candidate samples for self-labeling, and make predictions.
348+
# Remove the validation samples from the unlabeled data, if there, to avoid
349+
# self-labeling them.
348350
indices_unlabeled = data.get_indices_unlabeled()
351+
val_ind = set(data.get_indices_val())
352+
indices_unlabeled = np.asarray([ind for ind in indices_unlabeled
353+
if ind not in val_ind])
349354
predictions = trainer_cls.predict(
350355
session, indices_unlabeled, is_train=False)
351356
# Select most confident nodes. Compute confidence and most confident label,

0 commit comments

Comments
 (0)