-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
64e53cd
commit 8ea32f6
Showing
1 changed file
with
9 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,28 @@ | ||
class BaseAlgorithm(object): | ||
"""Base class for the algorithm. | ||
r"""Base class for all algorithms. | ||
All inherited subclasses should at least implement the following functions: | ||
1. __call__(self, config) | ||
Any algorithm should subclass this class. | ||
The subclass should implement at least the following: | ||
- __call__(self, config) | ||
""" | ||
def __init__(self, name): | ||
"""Initialize the algorithm. | ||
r"""Initialize the algorithm. | ||
Args: | ||
name (str): name of the algorithm | ||
""" | ||
self.name = name | ||
|
||
def __call__(self, config): | ||
"""Run the algorithm with given configurations. | ||
r"""Run the algorithm with given configuration. | ||
Args: | ||
config (OrderedDict): dictionary of configurations | ||
Returns: | ||
result (object): Result of the execution. | ||
If no need to return anything, then `return None` | ||
If no need to return anything, then an ``None`` should be returned. | ||
""" | ||
raise NotImplementedError |