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 / ap.py
Last active June 9, 2017 16:33
import numpy as np
from sklearn.metrics import precision_recall_curve, average_precision_score
def naive_interpolated_precision(y_true, y_scores):
precisions, recalls, _ = precision_recall_curve(y_true, y_scores)
interp_precisions = []
# the final point
precisions = precisions[:-1]
@vene
vene / Makefile
Created November 22, 2017 23:25
test cpu-only node with multi-device dynet
DYNET_PATH ?= /home/vlad/code/dynet
EIGEN_PATH ?= /home/vlad/code/eigen
CC = g++
DEBUG = -g
INCLUDES = -I$(DYNET_PATH) -I$(EIGEN_PATH)
LIBS = -L$(DYNET_PATH)/build-cuda/dynet/
CFLAGS = -O3 -Wall -Wno-sign-compare -Wno-int-in-bool-context -c -fmessage-length=0 $(INCLUDES) -DEIGEN_FAST_MATH -fPIC -fno-finite-math-only -Wno-missing-braces -std=c++11 -funroll-loops
LFLAGS = $(LIBS) -ldynet
""" Poisson-loss Factorization Machines with Numba
Follows the vanilla FM model from:
Steffen Rendle (2012): Factorization Machines with libFM.
In: ACM Trans. Intell. Syst. Technol., 3(3), May.
http://doi.acm.org/10.1145/2168752.2168771
See also: https://github.com/coreylynch/pyFM
"""
@vene
vene / nmf_faces.ipynb
Created October 29, 2013 15:54
Comparison of NMF solvers
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from collections import Counter
import numpy as np
from sklearn.metrics import euclidean_distances
from pyemd import emd as pyemd
def word_movers_distance(a, b, embeddings):
"""Word Mover's Distance.
A measure of text similarity: earth mover's distance in embedding metric space.
import numpy as np
from sklearn.datasets import load_iris
from sklearn.linear_model import LogisticRegression
from sklearn.utils import shuffle
# get shuffled iris data
X, y = load_iris(return_X_y=True)
X, y = shuffle(X, y, random_state=0)
@vene
vene / coordinate_descent.ipynb
Created June 30, 2016 15:27
simple cd solver for l2-regularized linear models
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vene
vene / sparsemax_loss_theano.ipynb
Created July 8, 2016 20:53
sparsemax loss for Theano
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vene
vene / keybase.md
Last active February 12, 2019 19:25

Keybase proof

I hereby claim:

  • I am vene on github.
  • I am vladn (https://keybase.io/vladn) on keybase.
  • I have a public key ASDuOJyHfNOqEqi3_3T0noSsAbKFt2dTowwoihXfRoguwAo

To claim this, I am signing this object:

@vene
vene / socket.io.js
Last active March 8, 2019 09:27
socketio-client 0.9.16 fork
/*! Socket.IO.js build:0.9.16, development. Copyright(c) 2011 LearnBoost <dev@learnboost.com> MIT Licensed */
/* Modifications by Vlad Niculae <vlad@vene.ro>
Available at https://gist.github.com/vene/c0657d854ae74a4511d2
Forked from https://raw.githubusercontent.com/Automattic/socket.io-client/ \
0.9.16/dist/socket.io.js
Changes: