Low rank approximation

Category: misc
#machine learning #python

A little experiment to see what low rank approximation looks like. These are the best rank-k approximations (in the Frobenius norm) to the a natural image for increasing values of k and an original image of rank 512.

Python code can be found here. GIF animation made using ImageMagic's convert …

qr_multiply function in scipy.linalg

Category: misc
#python #scipy

In scipy's development version there's a new function closely related to the QR-decomposition of a matrix and to the least-squares solution of a linear system. What this function does is to compute the QR-decomposition of a matrix and then multiply the resulting orthogonal factor by another arbitrary matrix. In pseudocode …

scikit-learn EuroScipy 2011 coding sprint -- day one

Category: misc
#scikit-learn #python

As a warm-up for the upcoming EuroScipy-conference, some of the scikit-learn developers decided to gather and work together for a couple of days. Today was the first day and there was only a handfull of us, as the real kickoff is expected tomorrow. Some interesting coding happened, although most of …

Ridge regression path

Category: misc
#scikit-learn #scipy #linear algebra

Ridge coefficients for multiple values of the regularization parameter can be elegantly computed by updating the thin SVD decomposition of the design matrix:

import numpy as np
from scipy import linalg
def ridge(A, b, alphas):
    Return coefficients for regularized least squares

         min ||A x - b||^2 + alpha ||x||^2 …

Computing the vector norm

Category: misc
#linear algebra #norm #scipy

Update: a fast and stable norm was added to scipy.linalg in August 2011 and will be available in scipy 0.10 Last week I discussed with Gael how we should compute the euclidean norm of a vector a using SciPy. Two approaches suggest themselves, either calling scipy.linalg.norm …

Smells like hacker spirit

Category: misc
#python #sklearn

I was last weekend in FOSDEM presenting scikits.learn (here are the slides I used at the Data Analytics Devroom). Kudos to Olivier Grisel and all the people who organized such a fun and authentic meeting!



LARS algorithm

Category: misc
#scikit-learn #sparse

I've been working lately with Alexandre Gramfort coding the LARS algorithm in scikits.learn. This algorithm computes the solution to several general linear models used in machine learning: LAR, Lasso, Elasticnet and Forward Stagewise. Unlike the implementation by coordinate descent, the LARS algorithm gives the full coefficient path along the …

Con la pasta por delante - Día cero

Category: misc

En la ciudad fabrican a las personas en serie. En el campo, los siguen haciendo a mano: los moldean, los secan al sol y luego los pintan, por eso son tan especiales. Primer concierto de la nueva gira en Mengíbar, y uno de los fines de semana más intensos que …

Cambiar el color de ls para terminales con fondo oscuro

Category: misc

Por fin encontré la manera para no dejarme la vista intentando distinguir azul oscuro sobre negro. Se trata de añadir el código a tu .bash_profile y los directorios se te colorearán de un verde mucho más legible alias ls='ls --color' LS_COLORS='di=1:fi=0:ln=31:pi=5 …

Los Esclavos 2.0

Category: misc

Después del concierto en Sevilla, fin de semana esclavo grabando en Daimiel, en La Mancha. Era mi primera vez grabando con Los Esclavos, y la verdad es que la cosa no pudo salir mejor, sonando bien y del tirón, sin mayores complicaciones. Al final serán 4 canciones que se colgarán …