def fit(self, x: np.ndarray, y: np.ndarray, batch_size: int = 128, nb_epochs: int = 10, **kwargs): """ Fit the classifier on the training set `(x, y)`. :param x: Training data. :param y: Target values (class labels) one-hot-encoded of shape (nb_samples, nb_classes) or indices of shape (nb_samples,). :param batch_size: Batch size. :key nb_epochs: Number of epochs to use for training :param kwargs: Dictionary of framework-specific arguments. This parameter is not currently supported for PyTorch and providing it takes no effect. :type kwargs: `dict` :return: `None` """ RandomizedSmoothingMixin.fit(self, x, y, batch_size=batch_size, nb_epochs=nb_epochs, **kwargs)
def predict(self, x: np.ndarray, batch_size: int = 128, **kwargs) -> np.ndarray: """ Perform prediction of the given classifier for a batch of inputs, taking an expectation over transformations. :param x: Test set. :param batch_size: Batch size. :param is_abstain: True if function will abstain from prediction and return 0s. Default: True :type is_abstain: `boolean` :return: Array of predictions of shape `(nb_inputs, nb_classes)`. """ return RandomizedSmoothingMixin.predict(self, x, batch_size=128, **kwargs)