Skip to content

RAM issues when returning the regularization path #26

@alexandre-pasco

Description

@alexandre-pasco

Hello,

When I use spams.lasso (and spams.omp) with return_reg_path=True, my RAM usage keeps increasing, and I don't get it back afterwise. So, by calling this function too often, my kernel crashes because of the RAM overconsumption. Do you have any ideas to solve this issue ? Thank you very much in advance.

The piece of code below shows the issue. I run it with python 3.9.15, spams 2.6.5.4, numpy 1.22.3 and psutil 5.9.0.

import psutil
import numpy as np
import spams

D = np.random.normal(size=(100, 1000))
D = D / np.linalg.norm(D, axis=0)
D = np.asfortranarray(D)
X = np.random.normal(size=(100, 100))
X = X / np.linalg.norm(X, axis=0)
X = np.asfortranarray(X)

for k in range(100):
    used_ram = psutil.virtual_memory().percent
    print(f'\rk:{k} used RAM:{used_ram}', end='')
    c, path = spams.lasso(X, D, lambda1=0, mode=2, return_reg_path=True)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions