PyTorch套索
用于L1正则化最小二乘(套索)问题的PyTorch库。 该库正在进行中。 欢迎和赞赏的贡献!
作者:Reuben Feinman(纽约大学)
乍看上去:
import torch
from lasso . linear import dict_learning , sparse_encode
# dummy data matrix
data = torch . randn ( 100 , 10 )
# Dictionary Learning
dictionary , losses = dict_learning ( data , n_components = 50 , alpha = 0.5 , algorithm = 'ista' )
# Sparse Coding (lasso solve)
coeffs = sparse_encode ( data , di
1