Skip to content

Commit 4a741d4

Browse files
Irina NicolaeIrina Nicolae
authored andcommitted
Update preprocessor interface
1 parent c1d318d commit 4a741d4

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

art/defences/preprocessor.py

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,38 +37,34 @@ def __call__(self, x, y=None):
3737
"""
3838
Perform data preprocessing and return preprocessed data as tuple.
3939
40-
:param x: (np.ndarray) Dataset to be preprocessed
41-
:param y: (np.ndarray) Labels to be preprocessed
40+
:param x: Dataset to be preprocessed.
41+
:type x: `np.ndarray`
42+
:param y: Labels to be preprocessed.
43+
:type y: `np.ndarray`
4244
:return: Preprocessed data
4345
"""
44-
pass
46+
raise NotImplementedError
4547

4648
@abc.abstractmethod
4749
def fit(self, x, y=None, **kwargs):
4850
"""
4951
Fit the parameters of the data preprocessor if it has any.
5052
51-
:param x: (np.ndarray) Training set to fit the preprocessor
52-
:param y: (np.ndarray) Labels for the training set
53-
:param kwargs: (dict) Other parameters
53+
:param x: Training set to fit the preprocessor.
54+
:type x: `np.ndarray`
55+
:param y: Labels for the training set.
56+
:type y: `np.ndarray`
57+
:param kwargs: Other parameters.
58+
:type kwargs: `dict`
5459
:return: None
5560
"""
5661
self._is_fitted = True
5762

58-
def predict(self, x, y=None):
59-
"""
60-
Perform data preprocessing and return preprocessed data as tuple.
61-
62-
:param x: (np.ndarray) Dataset to be preprocessed
63-
:param y: (np.ndarray) Labels to be preprocessed
64-
:return: Preprocessed data
65-
"""
66-
return self.__call__(x, y)
67-
6863
def set_params(self, **kwargs):
6964
"""
7065
Take in a dictionary of parameters and apply checks before saving them as attributes.
71-
:return: True when parsing was successful
66+
67+
:return: `True` when parsing was successful
7268
"""
7369
for key, value in kwargs.items():
7470
if key in self.params:

0 commit comments

Comments
 (0)