CVXOPT QP Solver: TypeError: 'A' Must Be A 'd' Matrix With 1000 Columns
I'm trying to use the CVXOPT qp solver to compute the Lagrange Multipliers for a Support Vector Machine def svm(X, Y, c): m = len(X) P = matrix(np.dot(Y, Y.T) * np.dot(
Solution 1:
Your matrix elements have to be of the floating-point type as well. So the error is removed by using A = A.astype('float')
to cast it.
Solution 2:
i have try A=A.astype(double)
to solve it, but it is invalid, since python doesn't know what double is or A has no method astype.
therefore
via using
A = matrix(A, (1, m), 'd')
could actually solve this problem!
Solution 3:
The error - "TypeError: 'A' must be a 'd' matrix with 1000 columns:"
has two condition namely:
- if the type code is not equal to '
d
' - if the
A.size[1] != c.size[0]
.
Check for these conditions.
Post a Comment for "CVXOPT QP Solver: TypeError: 'A' Must Be A 'd' Matrix With 1000 Columns"