Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
def draw_neural_net(ax, left, right, bottom, top, layer_sizes): | |
''' | |
Draw a neural network cartoon using matplotilb. | |
:usage: | |
>>> fig = plt.figure(figsize=(12, 12)) | |
>>> draw_neural_net(fig.gca(), .1, .9, .1, .9, [4, 7, 2]) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tempfile | |
import subprocess | |
import os | |
import pretty_midi | |
import librosa | |
def fast_fluidsynth(m, fs): | |
''' | |
Faster fluidsynth synthesis using the command-line program | |
instead of pyfluidsynth. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Dynamic time warping implementation in Theano | |
See also | |
https://github.com/astanway/theano-dtw | |
https://github.com/danielrenshaw/TheanoBatchDTW | |
''' | |
import theano | |
import theano.tensor as T |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"description": "CQT no beats", | |
"hypers": "{\"objective\": {\"hyper_dims\": {\"44672\": {\"bscale\": [0], \"bcenter\": [0]}, \"44673\": {\"bscale\": [1], \"bcenter\": [1]}, \"44674\": {\"bscale\": [2], \"bcenter\": [2]}, \"44675\": {\"bscale\": [3], \"bcenter\": [3]}, \"44676\": {\"bscale\": [4], \"bcenter\": [4]}, \"44677\": {\"bscale\": [5], \"bcenter\": [5]}, \"44678\": {\"bscale\": [6], \"bcenter\": [6]}}, \"nnet_parameters\": [{\"shape\": [7, 50], \"value\": \"eJwNlvc/FI4fx1FCwuejoRJJoSgpWsI7pOxZyPooojT4IDK+iRZKmRll5M7qzLM53hzHcZxZx4nO\\nqMgKDZ+sb//A65fn6/F8vb6Clzq888Cbknx/Jc+HwvcJPeVgp0k07ai6KUwJhwb3AlXbUTJ6UTaN\\nxUQVodpUv2Ui+SYOVI2mCPmycUNqDWGLJgHeeYYyv0TlQEr2S4N06Vo4Jra2+W79G0D/vrVfke0g\\npfbzzfCBbthy07Z/TO06Kscz6MaxHfiI97vQYXIfuEbUclUwmuDz/QslrtUsrPzVLksVHkS53Z61\\nRtIIe7W6j+jOEeG2uNf9F9JFmE31cNjBRcLFro2+vBJVKPD2qOzsQCOmUJWknlIG8JLLHe0Ht5tx\\nw5NqcpFfNxw3n7yVkYlQWEVQkCguwsHe8ZZDuaNYWnhya2MJwuhcxgaWTgvWRpNi/hlm4by9pg0h\\nmQrHTRP03YRJKK1bcErerQddRzkmPP8lwuUzEjsoLyqxcZ/ckxXjepTjFcyb+smBF2Of6s |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Create a tab-separated value file for uspop2002 entries which includes each | |
track's Echo Nest "loudness" score | |
""" | |
import pyen | |
import os | |
import time | |
# Put your Echo Nest API key in a file called .echonest_key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
os.chdir('..') | |
import sys | |
sys.path.append(os.getcwd()) | |
import normalize_names | |
import pickle | |
with open('data/Clean MIDIs-md5_to_artist_title.pickle') as f: | |
md5_to_artist_title = pickle.load(f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def mean_reciprocal_rank(X, Y, indices, metric='hamming'): | |
''' Computes the mean reciprocal rank of the correct match | |
Assumes that X[n] should be closest to Y[n] | |
Default uses hamming distance | |
:parameters: | |
- X : np.ndarray, shape=(n_examples, n_features) | |
Data matrix in X modality | |
- Y : np.ndarray, shape=(n_examples, n_features) | |
Data matrix in Y modality | |
- indices : np.ndarray |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Functions for computing the population count (aka Hamming weight) of an array | |
in-place using the built-in popcount routine. | |
Works with any integer datatype 64 bit-width or smaller. | |
Compile with gcc flag -mpopcnt | |
Adapted from | |
https://gist.github.com/aldro61/f604a3fa79b3dec5436a by Alexandre Drouin | |
""" | |
import numpy as np | |
cimport numpy as np |
OlderNewer