Externalize BlackboxClassifier dataset (x and predictions)

This commit is contained in:
abigailt 2022-07-25 15:47:04 +03:00 committed by abigailgold
parent fb534f7a0f
commit a13415ad67
2 changed files with 20 additions and 0 deletions

View file

@ -316,10 +316,20 @@ class BlackboxClassifierPredictions(BlackboxClassifier):
self._nb_classes = get_nb_classes(y_pred)
self._input_shape = x_pred.shape[1:]
self._x_pred = x_pred
self._y_pred = y_pred
predict_fn = (x_pred, y_pred)
self._art_model = BlackBoxClassifier(predict_fn, self._input_shape, self._nb_classes, fuzzy_float_compare=True,
preprocessing=None)
def get_predictions(self) -> Tuple[OUTPUT_DATA_ARRAY_TYPE, OUTPUT_DATA_ARRAY_TYPE]:
"""
Return all the data for which the model contains predictions.
:return: Tuple containing data and predictions as numpy arrays.
"""
return self._x_pred, self._y_pred
class BlackboxClassifierPredictFunction(BlackboxClassifier):
"""