This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function, division | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from itertools import product | |
import mne | |
import warnings | |
warnings.filterwarnings("ignore", category=DeprecationWarning) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from sklearn.linear_model import Lasso, lars_path | |
np.random.seed(42) | |
def gen_data(n, m, k): | |
X = np.random.randn(n, m) | |
w = np.zeros((m, 1)) | |
i = np.arange(0, m) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%MatrixMarket matrix coordinate real general | |
% | |
336 336 1144 | |
1 3 0.3333333333333333 | |
1 4 0.3333333333333333 | |
1 5 0.3333333333333333 | |
2 27 0.3333333333333333 | |
2 28 0.3333333333333333 | |
2 29 0.3333333333333333 | |
3 1 0.5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from numpy.linalg import norm, pinv | |
from sklearn.linear_model import orthogonal_mp | |
def omp_naive(D, y): | |
""" Recover x using naive implementation of OMP. | |
Parameter | |
--------- | |
D: Dictionary |