Closed davidslater closed 4 years ago
Hi @davidslater I have just remembered that we have already implemented this as part of the new Estimator API for the upcoming ART 1.3 where the new BaseEstimator
class and with it all estimators/classifiers in ART 1.3 will have a set_params
method for the BaseEstimator's attributes including preprocessing_defences
and postprocessing_defences
(https://github.com/IBM/adversarial-robustness-toolbox/blob/aceba4222e62b92f1675cc32177fde403b604a24/art/estimators/estimator.py#L73).
Would that work for you?
I think that this would work. Is there a get_params
method as well? That would make it straightforward to append defenses as well:
pre_defenses = estimator.get_params()["preprocessing_defenses"]
pre_defenses.append(new_defense)
estimator.set_params(preprocessing_defenses=pre_defenses)
I think that's a good idea. There is no get_params
so far, but we'll add it to BaseEstimator
as part of this issue.
Is your feature request related to a problem? Please describe. Currently, Preprocessor and Postprocessor defenses must be given at Classifier initialization, as they are set during initialization: https://github.com/IBM/adversarial-robustness-toolbox/blob/master/art/classifiers/classifier.py#L124-L132
Describe the solution you'd like Allow these to be set or appended to with seomthing like
set_params
orappend_preprocessing_defense
.Describe alternatives you've considered We have directly modified
Classifier.preprocessing_defences
andClassifier.postprocessing_defences
. This appears safe for the moment, but we would prefer to use an API.