{{ message }}

Instantly share code, notes, and snippets.

# Mathieu Blondel mblondel

Created Aug 14, 2013
Gaussian Process Regression
View gaussian_process.py
 """Gaussian processes""" # Author: Mathieu Blondel # License: BSD 3 clause import numpy as np from scipy.linalg import cholesky, solve_triangular from sklearn.base import BaseEstimator, RegressorMixin from sklearn.metrics.pairwise import pairwise_kernels
Created Apr 13, 2010
Logarithm of a sum without underflow
View logsum.py
 import numpy as np def _logsum(logx, logy): """ Return log(x+y), avoiding arithmetic underflow/overflow. logx: log(x) logy: log(y) Rationale:
Last active Jan 18, 2018
Out of scope
View out_of_scope.py
 def test(): print(i) i = 1 test()
Created May 22, 2015
Einstein sum notation
View einsum.py
 import numpy as np rng = np.random.RandomState(0) print "Trace" A = rng.rand(3, 3) print np.trace(A) print np.einsum("ii", A) print
Created Sep 3, 2017
Optimal transport dual LP
View ot_dual_lp.py
 # Author: Mathieu Blondel # License: BSD 3 clause import numpy as np from scipy.optimize import linprog def dual_lp(a, b, C, verbose=0): """Solves the dual optimal transport problem:
Last active May 13, 2017
Missing-value imputation
View imputer.py
 # (C) Mathieu Blondel # License: BSD 3 clause import numpy as np from numpy import ma import scipy.sparse as sp def _get_mask(X, missing_values, sparse=False): if sparse:
Last active May 13, 2017
Variable-length curve averaging
View curve_averaging.py
 """Variable-length curve averaging""" # Author: Mathieu Blondel # License: BSD 3 clause import numpy as np from scipy.interpolate import interp1d def curves_mean_std(X, Y, kind="linear"):
Created Aug 14, 2010
MCMC exercises
View mcmc_exercices.py
 """ Exercises for the Markov Chain Monte-Carlo (MCMC) course available at http://users.aims.ac.za/~ioana/ """ import numpy as np import numpy.linalg as la import pylab from scipy import stats
Created May 10, 2013
Cross-referencing in LaTeX.
View xref.txt
 paper.tex: main manuscript supp.tex: supplementary material Cross-referencing ----------------- We want to cross-reference equations in paper.tex from supp.tex.
Last active Dec 10, 2015
NNLS via LBFGS
View lbfgs_nnls.py
 # (C) Mathieu Blondel 2012 # License: BSD 3 clause import numpy as np from scipy.optimize import fmin_l_bfgs_b from sklearn.base import BaseEstimator, RegressorMixin from sklearn.utils.extmath import safe_sparse_dot