Skip to content

Instantly share code, notes, and snippets.

View aweinstein's full-sized avatar

Alejandro Weinstein aweinstein

  • Universidad de Valparaíso
  • Valparaíso, Chile
View GitHub Profile
@aweinstein
aweinstein / mne_test_raw_psd.py
Created October 10, 2017 14:37
Test all the combinations of dB and estimate when plotting the PSD of raw object.
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)
@aweinstein
aweinstein / lasso.py
Created October 3, 2012 18:20
scikitlearn lasso path fat vs thin X matrix
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)
@aweinstein
aweinstein / P.mtx
Created May 23, 2012 15:27
Testing execution time of scipy.sparse.linalg.eigs
%%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
@aweinstein
aweinstein / omp_issue.py
Created October 19, 2011 15:45
OMP scikit.learn issue
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