def _calc_dual_gap(self, X, Y):
        n_samples = len(X)
        # FIXME don't calculate this again
        joint_feature_gt = self.model.batch_joint_feature(X, Y, Y)
        Y_hat = self.model.batch_loss_augmented_inference(X, Y, self.w,
                                                          relaxed=True)
        djoint_feature = self.model.batch_joint_feature(X, Y_hat) - joint_feature_gt
        ls = np.sum(self.model.batch_loss(Y, Y_hat))
        ws = djoint_feature * self.C
        l_rescaled = self.l * n_samples * self.C

        dual_val = -0.5 * np.sum(self.w ** 2) + l_rescaled
        w_diff = self.w - ws
        dual_gap = w_diff.T.dot(self.w) - l_rescaled + ls * self.C
        primal_val = dual_val + dual_gap
        return dual_val, dual_gap, primal_val
dataset/ETHPy150Open pystruct/pystruct/pystruct/learners/frankwolfe_ssvm.py/FrankWolfeSSVM._calc_dual_gap/swapped operands of `-`