Skip to content

Instantly share code, notes, and snippets.

View fabianp's full-sized avatar
🏠
Working from home

Fabian Pedregosa fabianp

🏠
Working from home
View GitHub Profile
@fabianp
fabianp / svd_memory.py
Created December 10, 2012 14:10
Timings and memory consumption for the singular value decomposition implemented in scipy. The script svd_memory.py generates a plot about the memory consumption (requires the package `memory_profiler`) and the second one will plot the timings. The scripts will perform several iterations for matrices of different sizes and will take about 30 minu…
# .. Memory benchmarks for SciPy's Singular Value Decomposition ..
# .. Author: Fabian Pedregosa <fabian@fseoane.net>
import numpy as np
from scipy.sparse import linalg as splinalg
from scipy import sparse, linalg
import pylab as pl
from memory_profiler import memory_usage
dims = np.arange(500, 1500, 20)
@fabianp
fabianp / lars_ill.ipynb
Created October 28, 2012 18:16
lars ill conditioned
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fabianp
fabianp / gist:3568540
Created September 1, 2012 09:51
isotonic regression benchmarks
import numpy as np
# Author : Fabian Pedregosa <fabian@fseoane.net>
#
# License : BSD
def isotonic_regression_new(w, y, x_min=None, x_max=None):
"""
Solve the isotonic regression with complete ordering model:
@fabianp
fabianp / gist:3097107
Created July 12, 2012 09:58
strong rules lasso
# -*- coding: utf-8 -*-
"""
Strong rules for coordinate descent
Author: Fabian Pedregosa <fabian@fseoane.net>
"""
import numpy as np
from scipy import linalg
@fabianp
fabianp / coordinate_descent.py
Created July 12, 2012 07:47
minimalistic l1 coordinate descent
# -*- coding: utf-8 -*-
"""
Minimalistic implementation of l1 minimization via coordinate descent.
Reference: www.jstatsoft.org/v33/i01/paper
Author: Fabian Pedregosa <fabian@fseoane.net>
"""
import numpy as np
@fabianp
fabianp / gist:3081831
Created July 10, 2012 07:33
Pool Adjacent Violators
import numpy as np
# Author : Alexandre Gramfort
# license : BSD
def pav(y):
"""
PAV uses the pair adjacent violators method to produce a monotonic
smoothing of y
@fabianp
fabianp / isotonic_regression.py
Created April 23, 2012 09:04
isotonic regression
import numpy as np
def isotonic_regression(w, y, x_min=None, x_max=None):
"""
Solve the isotonic regression model:
min Sum w_i (y_i - x_i) ** 2
subject to x_min = x_1 <= x_2 ... <= x_n = x_max
@fabianp
fabianp / pty.py
Created March 31, 2012 20:11
Implementation of pty program from "Advanced Programming in the UNIX Environment"
import sys, os, termios, tty
pid, fd = os.forkpty()
term_info = termios.tcgetattr(sys.stdin.fileno())
if pid < 0:
raise ValueError("Early exit: could not fork process")
elif pid == 0:
# .. child ..
@fabianp
fabianp / ranking.py
Last active February 1, 2024 10:02
Pairwise ranking using scikit-learn LinearSVC
"""
Implementation of pairwise ranking using scikit-learn LinearSVC
Reference:
"Large Margin Rank Boundaries for Ordinal Regression", R. Herbrich,
T. Graepel, K. Obermayer 1999
"Learning to rank from medical imaging data." Pedregosa, Fabian, et al.,
Machine Learning in Medical Imaging 2012.
@fabianp
fabianp / nullclient.c
Created February 24, 2012 22:48
nullclient from libpurple
/*
* pidgin
*
* Pidgin is the legal property of its developers, whose names are too numerous
* to list here. Please refer to the COPYRIGHT file distributed with this
* source distribution.
*
* 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