Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
target subject labels (`train_labels`).
"""
# target class labels
if targets is None:
targets = list(six.itervalues(self._subject2label))
elif isinstance(targets, six.string_types):
targets = [targets]
dists = []
train_labels = []
for label in targets:
# compute distances
D = metrics.cdist(data, self.io_load(label),
metric=self.metric, **self.metric_args)
dists.append(D)
train_labels.append(np.tile(label, D.shape))
dists = np.concatenate(dists, axis=1)
train_labels = np.concatenate(train_labels, axis=1)
# sort
dists, train_labels = self._sort(dists, train_labels)
return {'dists': dists, 'train_labels': train_labels}