Skip to content
Snippets Groups Projects
Commit c22c0051 authored by Yannick DAYER's avatar Yannick DAYER
Browse files

[py] Added distance prediction and scoring

Added a test in AlgorithmAdaptator enroll and score to not apply
'project()' in a distance algorithm.
parent 707e0a3b
No related branches found
No related tags found
1 merge request!2Added distance prediction and scoring
Pipeline #37183 failed
...@@ -581,9 +581,12 @@ class AlgorithmAdaptor: ...@@ -581,9 +581,12 @@ class AlgorithmAdaptor:
def enroll(self, k): def enroll(self, k):
self.load() self.load()
return self.model.enroll( if self.model.requires_projector_training:
[self.model.project(s.data) for s in k.samples] return self.model.enroll(
) [self.model.project(s.data) for s in k.samples]
)
else:
return [s.data for s in k.samples]
def write_enrolled(self, k, path): def write_enrolled(self, k, path):
self.model.write_model(k, path) self.model.write_model(k, path)
...@@ -652,7 +655,11 @@ class AlgorithmAdaptor: ...@@ -652,7 +655,11 @@ class AlgorithmAdaptor:
retval = [] retval = []
for p in probes: for p in probes:
data = [model.project(s.data) for s in p.samples] if model.requires_projector_training:
data = [model.project(s.data) for s in p.samples]
else:
data = [s.data for s in p.samples]
for subprobe_id, (s, parent) in enumerate(zip(data, p.samples)): for subprobe_id, (s, parent) in enumerate(zip(data, p.samples)):
# each sub-probe in the probe needs to be checked # each sub-probe in the probe needs to be checked
subprobe_scores = [] subprobe_scores = []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment