CVXPY падает на лассо с ядром - PullRequest
0 голосов
/ 18 апреля 2020

Я пытаюсь запустить CVXPY для решения регрессии лассо с ядром.

Когда количество предикторов возрастает (моя цель - иметь 3000 из них), оно вылетает с ошибкой "Killed" или «ошибка allo c».

import cvxpy as cp
import numpy as np
import scipy

np.random.seed(0)
NUM_PREDICTORS = 500
NUM_SAMPLES = 1
l1 = 10
x = np.random.randn(NUM_SAMPLES, NUM_PREDICTORS)
y = np.random.randn(NUM_SAMPLES, 1)
xx = x.T @ x
yx = y.T @ x
xx_sqrt = scipy.linalg.sqrtm(xx)
b = cp.Variable(yx.T.shape)
u = cp.sum_squares(xx_sqrt @ b) - cp.sum(2 * yx @ b) + l1 * cp.norm(b, 1)
obj = cp.Minimize(u)
prob = cp.Problem(obj)
prob.solve()
print('done')
...