Skip to content

Instantly share code, notes, and snippets.

'''
Parses crop file to create forward pass embeddings
'''
import os
import sys
import simplejson as json
import time
import multiprocessing as mp
'''
Parses crop file to create forward pass embeddings
'''
import os
import sys
import simplejson as json
import time
import multiprocessing as mp
import numpy as np
from skimage.transform import resize
from PIL import Image, ImageOps, ImageEnhance
def generate_jitter(payload):
path, idxs, img_size = payload
image = open_pad_image(path)
w, h = image.size
if random.random() < ROTATE_PROB:
@atqamar
atqamar / test.py
Last active February 1, 2016 19:34
>>> def f(a, b, *args, **kwargs):
... print 'a:', a
... print 'b:', b
... print 'args:', args
... print 'kwargs:', kwargs
...
>>>
>>> f(1, 2, 3, 4)
a: 1
b: 2
>>> t = loader('word2vec2-track-40-blacklisted.tree', 40)
found 10 roots with degree 3610380
>>> item_vec(1926092)
[-0.61222898960113525, 0.40110298991203308, -0.86882501840591431, -0.40390399098396301, 1.5739649534225464, 2.9912350177764893, 1.2347650527954102, -2.8840279579162598, -1.6604549884796143, 0.54188698530197144, 1.1412789821624756, 1.241657018661499, -1.0545389652252197, 0.26847600936889648, -0.25054800510406494, 0.075194999575614929, 0.18987299501895905, -0.88793599605560303, 0.13406600058078766, -0.66986697912216187, 1.7543129920959473, -2.12192702293396, -1.9274799823760986, -1.4863320589065552, -0.048367001116275787, 4.0147228240966797, 2.0764510631561279, -0.91519302129745483, 1.449802041053772, 0.0013439999893307686, 1.447721004486084, 2.7600500583648682, 0.5310789942741394, 1.1490709781646729, -3.2139129638671875, -1.2849889993667603, -1.6008919477462769, -1.5216890573501587, 0.94182801246643066, -0.58957099914550781]
>>> t = loader('word2vec2-track-40.tree', 40)
found 10 roots with degree
[info] Resolving org.jacoco#org.jacoco.agent;0.7.1.201405082137 ...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Here are some of the libraries that were evicted:
[warn] * com.google.guava:guava:(14.0.1, 16.0, 15.0, 14.0, 11.0.2) -> 18.0
[warn] Run 'evicted' to see detailed eviction warnings
[info] Compiling 107 Scala sources and 51 Java sources to /Users/qamar/rec-sys-scalding/target/scala-2.10/classes...
[warn] Note: Some input files use unchecked or unsafe operations.
[warn] Note: Recompile with -Xlint:unchecked for details.
[error] /Users/qamar/rec-sys-scalding/src/main/scala/com/spotify/recsys/job/LibraryTrackAdds.scala:5: object reportingrecords is not a member of package com.spotify.data
spotify:track:3VwobP6dbSUkIAl34P1csC
spotify:track:1rYbvZENGboOkeB0qzAlVj
spotify:track:1JK3ppo006rbhBCAskTWid
spotify:track:0qLzsHMejKWXGhHOZzDNLe
spotify:track:4JVeSjOgryUGJ0yo4mqYBK
spotify:track:6Ww9LLFCEPUupx7wy3jZnN
spotify:track:2W8fX4k2JLQJJ1SG0yRcHk
spotify:track:1PxeVXU16vI9Mf09ntfaPZ
spotify:track:29hKUUhAgUJoRTp7yaPVYJ
spotify:track:5jwSjba4Rm0y9p6CYwQowU
sriram (srirampmalladi)
0.0974 metal
0.0779 speed metal
0.0714 progressive metal
0.0714 power metal
0.0649 neo classical metal
0.0519 melodic death metal
0.0390 black metal
0.0390 death metal
0.0390 folk metal
sriram (srirampmalladi)
0.3645 Folk Metal / Viking Metal / Melodic Death Metal
0.2415 Death Metal / Metal / Groove Metal
0.2103 Groove Metal / Nu Metal / Alternative Metal
0.1091 Rock / Hard Rock / Metal
0.0747 Metal / Speed Metal / Neo Classical Metal
chris (mrchrisjohnson)
0.3737 Noise Pop / Chillwave / Freak Folk
0.2255 Chillwave / Nu Gaze / Noise Pop
import numpy as np
import numpy.linalg as la
from annoy import AnnoyIndex
from spotify.rec_sys_batch.item_maps import ItemMaps
from spotify.util.uri import GidURI, decode_uuid4
BUILD = '2015-W17'
ROOT = '/var/rec-sys/%s' % BUILD
tree = AnnoyIndex(40)