def reconstruct(self, x: np.ndarray, y: np.ndarray | None = None, **kwargs) -> tuple[np.ndarray, np.ndarray]:
        """
        Infer the missing row from x, y with which `estimator` was trained with.

        :param x: Known records of the training set of `estimator`.
        :param y: Known labels of the training set of `estimator`.
        """
        if y is None:
            y = self.estimator.predict(x=x)

        if y.ndim == 2:
            y = np.argmax(y, axis=1)

        tol = float("inf")
        x_0 = x[0, :]
        x_guess: np.ndarray | None = None
        y_guess: int

        for _y in range(self.estimator.nb_classes):
            args = (_y, x, y, self._estimator, self.estimator, self.params)
            _x, _tol, _ = fmin_l_bfgs_b(
                self.objective, x_0, args=args, approx_grad=True, factr=100, pgtol=1e-10, bounds=None
            )

            if _tol < tol:
                tol = _tol
                x_guess = _x
                y_guess = _y

        if x_guess is None:
            raise ValueError("Guessed values are None.")

        x_reconstructed = np.expand_dims(x_guess, axis=0)
        y_reconstructed = np.zeros(shape=(1, self.estimator.nb_classes))
        y_reconstructed[0, y_guess] = 1

        return x_reconstructed, y_reconstructed

        Infer the missing row from x, y with which `estimator` was trained with.

        :param x: Known records of the training set of `estimator`.
        :param y: Known labels of the training set of `estimator`.
        
art/attacks/inference/reconstruction/white_box.py