From e26e2727abbbf6fa1875215ace2b9e3e2edd85d3 Mon Sep 17 00:00:00 2001
From: Manuel Gunther <siebenkopf@googlemail.com>
Date: Tue, 5 Apr 2016 16:14:07 -0600
Subject: [PATCH] Fixed issues with Distance algorithm

---
 bob/bio/base/algorithm/Distance.py | 22 +++++++++++++++++++++-
 doc/implemented.rst                |  1 +
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/bob/bio/base/algorithm/Distance.py b/bob/bio/base/algorithm/Distance.py
index 10291337..341ede9b 100644
--- a/bob/bio/base/algorithm/Distance.py
+++ b/bob/bio/base/algorithm/Distance.py
@@ -6,6 +6,7 @@ import numpy
 import scipy.spatial
 
 from .Algorithm import Algorithm
+from .. import utils
 
 import logging
 logger = logging.getLogger("bob.bio.base")
@@ -72,6 +73,25 @@ class Distance (Algorithm):
     # just store all the features
     return numpy.vstack([f.flatten() for f in enroll_features])
 
+
+  def read_probe(self, probe_file):
+    """read_probe(probe_file) -> probe
+
+    Reads the probe feature from the given HDF5 file.
+
+    **Parameters:**
+
+    probe_file : str or :py:class:`bob.io.base.HDF5File`
+      The file (open for reading) or the name of an existing file to read from.
+
+    **Returns:**
+
+    probe : object
+      The probe.
+    """
+    return utils.load(feature_file)
+
+
   def score(self, model, probe):
     """score(model, probe) -> float
 
@@ -104,7 +124,7 @@ class Distance (Algorithm):
   def train_projector(*args,**kwargs): raise NotImplementedError()
   def load_projector(*args,**kwargs): pass
   def project(*args,**kwargs): raise NotImplementedError()
-  def write_feature(*args,**kwargs): raise NotImplementedError()
   def read_feature(*args,**kwargs): raise NotImplementedError()
+  def write_feature(*args,**kwargs): raise NotImplementedError()
   def train_enroller(*args,**kwargs): raise NotImplementedError()
   def load_enroller(*args,**kwargs): pass
diff --git a/doc/implemented.rst b/doc/implemented.rst
index 2830f842..6737d580 100644
--- a/doc/implemented.rst
+++ b/doc/implemented.rst
@@ -24,6 +24,7 @@ Implementations
 
 .. autosummary::
    bob.bio.base.extractor.Linearize
+   bob.bio.base.algorithm.Distance
    bob.bio.base.algorithm.PCA
    bob.bio.base.algorithm.LDA
    bob.bio.base.algorithm.PLDA
-- 
GitLab