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:
View fista.py
"""
Efficient implementation of FISTA.
"""
# Author: Mathieu Blondel
# License: BSD 3 clause
import numpy as np
View seminb.py
# -*- coding: utf-8 -*-
# Copyright (C) 2010 Mathieu Blondel
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
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
View multiclass_svm.py
"""
Multiclass SVMs (Crammer-Singer formulation).
A pure Python re-implementation of:
Large-scale Multiclass Support Vector Machine Training via Euclidean Projection onto the Simplex.
Mathieu Blondel, Akinori Fujino, and Naonori Ueda.
ICPR 2014.
http://www.mblondel.org/publications/mblondel-icpr2014.pdf
"""
View projection_simplex.py
"""
Implements three algorithms for projecting a vector onto the simplex: sort, pivot and bisection.
For details and references, see the following paper:
Large-scale Multiclass Support Vector Machine Training via Euclidean Projection onto the Simplex
Mathieu Blondel, Akinori Fujino, and Naonori Ueda.
ICPR 2014.
http://www.mblondel.org/publications/mblondel-icpr2014.pdf
View out_of_scope.py
def test():
print i
i = 1
test()
View nmf_cd.py
"""
NMF by coordinate descent, designed for sparse data (without missing values)
"""
# Author: Mathieu Blondel <mathieu@mblondel.org>
# License: BSD 3 clause
import numpy as np
import scipy.sparse as sp
import numba
View local_regression.py
"""Local regression"""
# Author: Mathieu Blondel <mathieu@mblondel.org>
# License: BSD 3 clause
import numpy as np
from sklearn.base import BaseEstimator, RegressorMixin
from sklearn.metrics.pairwise import pairwise_kernels
from sklearn.linear_model import Ridge
View letor_metrics.py
# (C) Mathieu Blondel, November 2013
# License: BSD 3 clause
import numpy as np
def ranking_precision_score(y_true, y_score, k=10):
"""Precision at rank k
Parameters