在下面的代码片段中,我尝试使用 cvxpy 和 mosek 求解器进行非常简单的线性回归
weight = df2['weight'].to_numpy()
A = df2[ regressors ].to_numpy()
x = cp.Variable(len(regressors ));
R = df2['y'].to_numpy()
cost = cp.sum_squares( A @ x - R)
print(A.shape, x.shape, R.shape) # here it prints (134882, 8) (8,) (134882,)
prob = cp.Problem(cp.Minimize(cost),
[x >= 0])
但我一直低于错误。
Error: rescode.err_lower_bound_is_a_nan(1390): The lower bound specified is not a number (nan).
我检查了手册:https ://docs.mosek.com/latest/pythonapi/response-codes.html#mosek.rescode.err_lower_bound_is_a_nan 但我到底错过了什么?