This file contains 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 time | |
from sklearn.linear_model import LogisticRegression, LogisticRegressionCV | |
from sklearn.datasets import fetch_mldata | |
if __name__ == "__main__": | |
mnist = fetch_mldata('MNIST original') | |
X = mnist.data[::10] |
This file contains 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
# Author: Tom Dupre la Tour | |
# License: BSD 3 clause | |
Greedy Coordinate Descent for Non-Negative Matrix Factorization | |
in scikit-learn. | |
To change the Coordinate Descent into a Greedy Coordinate Descent, | |
change the call to | |
_update_cdnmf_fast(W, HHt, XHt, shuffle, seed) (in nmf.py) | |
into |
This file contains 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 gc | |
import time | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from sklearn.datasets import fetch_rcv1 | |
from sklearn.preprocessing import LabelBinarizer | |
from sklearn.linear_model import LogisticRegression | |
from sklearn.linear_model.logistic import _multinomial_loss | |
from sklearn.externals.joblib import Memory |
This file contains 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
# Author: Tom Dupre la Tour <tom.dupre-la-tour@m4x.org> | |
# License: BSD 3 clause | |
from __future__ import print_function | |
from time import time | |
import numpy as np | |
import scipy.sparse as sp | |
import matplotlib.pyplot as plt | |
import pandas |
This file contains 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 | |
def monte_carlo(n_trajects, n_clients, n_iter, capacity=None, plot=False): | |
# maximum capacity by car is here unlimited | |
if capacity is None: | |
capacity = n_clients | |
# draw within an uniform distribution |
This file contains 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 warnings | |
import neo.io | |
def smr2sig(filename, smr_nums=[0]): | |
""" | |
read signal from .smr file (Spike2) | |
parameters | |
---------- | |
filename : name of file |
This file contains 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 sklearn.datasets import fetch_olivetti_faces | |
from sklearn.decomposition.nmf import NMF | |
from sklearn.externals.joblib import Parallel, delayed | |
def fit(X): | |
nmf.fit(X) | |
def nmf_test(n_jobs=-1, backend='multiprocessing'): |
This file contains 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 | |
import warnings | |
import numpy as np | |
import neo.io | |
from mne.io.array import RawArray | |
from mne import create_info | |
def _smr(filename): |
This file contains 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 re | |
import os | |
# find existing links | |
matches = [] | |
with open('whats_new.rst', 'r') as f: | |
for line in f.readlines(): | |
m = re.search('`[A-Za-z üéö@.ä-]*`_', line) | |
if m is not None: | |
matches.append(m.group(0)) |
This file contains 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 | |
import sys | |
import time | |
# copy from MNE-Python | |
class ProgressBar(): | |
"""Class for generating a command-line progressbar | |
Parameters | |
---------- |
OlderNewer