I'm trying to solve a dual problem of the standard SVM optimization problem given by:
The code is simple:
X = cp.Parameter((n, 2))
X.value = np.einsum("j,jk->jk", df["y"].to_numpy(), df[["x1", "x2"]].to_numpy())
y = cp.Parameter(n)
y.value = df["y"].to_numpy()
w = cp.Variable(n)
ones = cp.Parameter(n)
ones.value = np.ones(n)
obj = cp.Maximize(-1/2 * w.T @ X @ X.T @ w + ones.T @ w)
constraints = [w >= 0,
w <= ones,
w.T @ y == 0]
prob = cp.Problem(obj, constraints)
prob.solve()
But getting:
DCPError: Problem does not follow DCP rules. Specifically:
The objective is not DCP. Its following subexpressions are not:
Promote(-0.5, (200,)) @ var366 @ param364 @ param364.T @ var366
