Skip to content

Instantly share code, notes, and snippets.

View vene's full-sized avatar
🏴
ahoy

Vlad Niculae vene

🏴
ahoy
View GitHub Profile
@vene
vene / newton-interpolation.py
Created April 15, 2011 11:25
Newton interpolation and numerical differentiation
# -*- coding: utf-8 -*-
"""
Newton interpolation and numerical differentiation
Created on Sun Apr 10 01:22:46 2011
@author: vene
"""
from __future__ import division
from copy import copy
@vene
vene / omp.py
Created May 28, 2011 10:23
naive, cholesky and batch Orthogonal Matching Pursuit
# -*- coding: utf-8 -*-
"""
http://www.cs.technion.ac.il/~ronrubin/Publications/KSVD-OMP-v2.pdf
parametrization by error is still in progress
"""
from time import time
import numpy as np
from scipy import linalg
import matplotlib.pyplot as pl
@vene
vene / svr_anscombe.py
Created May 27, 2012 19:21
Support vector regression on Anscombe's third dataset
import os
import numpy as np
import matplotlib.pylab as pl
from sklearn.svm import SVR
from sklearn.metrics import mean_squared_error
X = np.array([[13.], # This is dataset no. 3 from Anscombe's quartet.
[10.], # I moved the outlier to the first position for
[8.], # prettier code. This toy dataset illustrates
@vene
vene / magic_memit.py
Created June 30, 2012 06:55
memit: magic memory usage benching for IPython
# Author: Vlad Niculae <[email protected]>
# Makes use of memory_profiler from Fabian Pedregosa
# available at https://github.com/fabianp/memory_profiler
from IPython.core.magic import Magics, line_magic, magics_class
class MemMagics(Magics):
@line_magic
def memit(self, line='', setup='pass'):
@vene
vene / bench_eucl.py
Created August 9, 2012 16:44
Benchmark euclidean_distances
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse import issparse
from sklearn.utils import atleast2d_or_csr
from sklearn.utils.extmath import safe_sparse_dot
from sklearn.metrics.pairwise import check_pairwise_arrays, euclidean_distances
from sklearn.metrics.euclidean_fast import dense_euclidean_distances, sparse_euclidean_distances
@vene
vene / grouped_score.py
Created November 2, 2012 23:56
Grouped score in scikit-learn proof of concept
import numpy as np
from sklearn.metrics import zero_one_score
# Input data corresponds to 4 words:
# - descalcarea (des-cal-ca-rea, predicted: de-s-cal-ca-rea)
# - somnolezi (som-no-lezi, predicted: som-no-lezi)
# - salandere (sa-lan-de-re, predicted: sa-lan-de-re)
y_pred = np.array(
[False, True, True, False, False, True, False, True, False,
@vene
vene / lbfgs_nnls.py
Last active December 10, 2015 11:48 — forked from mblondel/lbfgs_nnls.py
# (C) Mathieu Blondel 2012
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
class LbfgsNNLS(BaseEstimator, RegressorMixin):
@vene
vene / UncertainEnglish
Last active December 24, 2015 14:59
temporal text classification
{
"metadata": {
"name": "EnglishDating"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@vene
vene / compare_nmf.ipynb
Last active December 26, 2015 18:48
Compare NMF solvers
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vene
vene / nmf_faces.ipynb
Created October 29, 2013 15:54
Comparison of NMF solvers
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.