Skip to content
Snippets Groups Projects
Commit 6c879a85 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

Merge branch '64-base-classes-are-not-new-style-classes' into 'master'

Resolve "Base classes are not new-style classes"

Closes #64

See merge request !64
parents 4d92fe52 6f288bf6
No related branches found
Tags v4.0.1
1 merge request!64Resolve "Base classes are not new-style classes"
Pipeline #
...@@ -7,7 +7,7 @@ import numpy ...@@ -7,7 +7,7 @@ import numpy
import os import os
from .. import utils from .. import utils
class Algorithm: class Algorithm (object):
"""This is the base class for all biometric recognition algorithms. """This is the base class for all biometric recognition algorithms.
It defines the minimum requirements for all derived algorithm classes. It defines the minimum requirements for all derived algorithm classes.
......
...@@ -73,8 +73,7 @@ class BIC(Algorithm): ...@@ -73,8 +73,7 @@ class BIC(Algorithm):
): ):
# call base class function and register that this tool requires training for the enrollment # call base class function and register that this tool requires training for the enrollment
Algorithm.__init__( super(BIC, self).__init__(
self,
requires_enroller_training=True, requires_enroller_training=True,
comparison_function=str(comparison_function), comparison_function=str(comparison_function),
......
...@@ -37,8 +37,7 @@ class Distance (Algorithm): ...@@ -37,8 +37,7 @@ class Distance (Algorithm):
): ):
# call base class constructor and register that the algorithm performs a projection # call base class constructor and register that the algorithm performs a projection
Algorithm.__init__( super(Distance, self).__init__(
self,
distance_function = str(distance_function), distance_function = str(distance_function),
is_distance_function = is_distance_function, is_distance_function = is_distance_function,
......
...@@ -65,8 +65,7 @@ class LDA (Algorithm): ...@@ -65,8 +65,7 @@ class LDA (Algorithm):
): ):
# call base class constructor and register that the LDA tool performs projection and need the training features split by client # call base class constructor and register that the LDA tool performs projection and need the training features split by client
Algorithm.__init__( super(LDA, self).__init__(
self,
performs_projection = True, performs_projection = True,
split_training_features_by_client = True, split_training_features_by_client = True,
......
...@@ -49,8 +49,7 @@ class PCA (Algorithm): ...@@ -49,8 +49,7 @@ class PCA (Algorithm):
): ):
# call base class constructor and register that the algorithm performs a projection # call base class constructor and register that the algorithm performs a projection
Algorithm.__init__( super(PCA, self).__init__(
self,
performs_projection = True, performs_projection = True,
subspace_dimension = subspace_dimension, subspace_dimension = subspace_dimension,
......
...@@ -37,8 +37,7 @@ class PLDA (Algorithm): ...@@ -37,8 +37,7 @@ class PLDA (Algorithm):
"""Initializes the local (PCA-)PLDA tool chain with the given file selector object""" """Initializes the local (PCA-)PLDA tool chain with the given file selector object"""
# call base class constructor and register that this class requires training for enrollment # call base class constructor and register that this class requires training for enrollment
Algorithm.__init__( super(PLDA, self).__init__(
self,
requires_enroller_training = True, requires_enroller_training = True,
subspace_dimension_of_f = subspace_dimension_of_f, # Size of subspace F subspace_dimension_of_f = subspace_dimension_of_f, # Size of subspace F
...@@ -113,7 +112,7 @@ class PLDA (Algorithm): ...@@ -113,7 +112,7 @@ class PLDA (Algorithm):
"""Generates the PLDA base model from a list of arrays (one per identity), """Generates the PLDA base model from a list of arrays (one per identity),
and a set of training parameters. If PCA is requested, it is trained on the same data. and a set of training parameters. If PCA is requested, it is trained on the same data.
Both the trained PLDABase and the PCA machine are written.""" Both the trained PLDABase and the PCA machine are written."""
# arrange PLDA training data # arrange PLDA training data
training_features = self._arrange_data(training_features) training_features = self._arrange_data(training_features)
......
...@@ -7,7 +7,7 @@ import os ...@@ -7,7 +7,7 @@ import os
from .. import utils from .. import utils
class Extractor: class Extractor (object):
"""This is the base class for all feature extractors. """This is the base class for all feature extractors.
It defines the minimum requirements that a derived feature extractor class need to implement. It defines the minimum requirements that a derived feature extractor class need to implement.
......
...@@ -15,7 +15,7 @@ class Linearize(Extractor): ...@@ -15,7 +15,7 @@ class Linearize(Extractor):
def __init__(self, dtype=None): def __init__(self, dtype=None):
"""If the ``dtype`` parameter is given, it specifies the data type that is enforced for the features.""" """If the ``dtype`` parameter is given, it specifies the data type that is enforced for the features."""
Extractor.__init__(self, dtype=dtype) super(Linearize, self).__init__(dtype=dtype)
self.dtype = dtype self.dtype = dtype
def __call__(self, data): def __call__(self, data):
......
...@@ -21,7 +21,7 @@ PREDEFINED_QUEUES = { ...@@ -21,7 +21,7 @@ PREDEFINED_QUEUES = {
from . import utils from . import utils
class Grid: class Grid (object):
"""This class is defining the options that are required to submit parallel jobs to the SGE grid, or jobs to the local queue. """This class is defining the options that are required to submit parallel jobs to the SGE grid, or jobs to the local queue.
If the given ``grid_type`` is ``'sge'`` (the default), this configuration is set up to submit algorithms to the SGE grid. If the given ``grid_type`` is ``'sge'`` (the default), this configuration is set up to submit algorithms to the SGE grid.
......
...@@ -15,7 +15,7 @@ class Filename (Preprocessor): ...@@ -15,7 +15,7 @@ class Filename (Preprocessor):
def __init__(self): def __init__(self):
# call base class constructor, using a custom ``read_original_data`` that does nothing and always returns None # call base class constructor, using a custom ``read_original_data`` that does nothing and always returns None
Preprocessor.__init__(self, writes_data=False, read_original_data = lambda x,y,z: None) super(Filename, self).__init__(writes_data=False, read_original_data = lambda x,y,z: None)
# The call function (i.e. the operator() in C++ terms) # The call function (i.e. the operator() in C++ terms)
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
from .. import utils from .. import utils
class Preprocessor: class Preprocessor (object):
"""This is the base class for all preprocessors. """This is the base class for all preprocessors.
It defines the minimum requirements for all derived proprocessor classes. It defines the minimum requirements for all derived proprocessor classes.
......
...@@ -32,7 +32,7 @@ def indices(list_to_split, number_of_parallel_jobs, task_id=None): ...@@ -32,7 +32,7 @@ def indices(list_to_split, number_of_parallel_jobs, task_id=None):
return (start, end) return (start, end)
class GridSubmission: class GridSubmission (object):
def __init__(self, args, command_line_parameters, executable = 'verify.py', first_fake_job_id = 0): def __init__(self, args, command_line_parameters, executable = 'verify.py', first_fake_job_id = 0):
# find, where the executable is installed # find, where the executable is installed
import bob.extension import bob.extension
...@@ -49,7 +49,7 @@ class GridSubmission: ...@@ -49,7 +49,7 @@ class GridSubmission:
if args.grid is not None: if args.grid is not None:
assert isinstance(args.grid, grid.Grid) assert isinstance(args.grid, grid.Grid)
self.env = args.env #Fetching the enviroment variable self.env = args.env #Fetching the enviroment variable
# find, where jman is installed # find, where jman is installed
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment