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 numpy as np | |
import tqdm | |
import timeit | |
np.random.seed(42) | |
d = 100 | |
N = 1000 | |
# gold value | |
w_star = np.random.randn(d) | |
b_star = np.random.randn(1) |
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 | |
# reporting the best results per-team (and top 10) | |
data ={'2011': | |
[0.25770, 0.31010, 0.35960, 0.50450], | |
'2012': | |
[0.15315, 0.26172, 0.26979, 0.27058, 0.29576, 0.33419, 0.34464], | |
'2013': | |
[0.11197, 0.12953, 0.13511, 0.13555, 0.13748, 0.13985, 0.14182, | |
0.14291, 0.15193, 0.15245], |
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
# encoding=utf-8 | |
# --- Adapted From --- | |
# Project: learn-pytorch | |
# Author: xingjunjie github: @gavinxing | |
# Create Time: 29/07/2017 11:58 AM on PyCharm | |
# Original code at: https://gist.github.com/GavinXing/9954ea846072e115bb07d9758892382c | |
import torch | |
import torch.nn as nn | |
import torch.autograd as autograd |
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 torch | |
import torch.nn as nn | |
from torch.autograd import Variable | |
class SimpleW2V(nn.Module): | |
def __init__(self, nwords, ncontexts, vec_size): | |
super(SimpleW2V, self).__init__() | |
# randomly initialized vectors | |
self.words_emb = nn.Embedding(nwords, vec_size) |
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
#!/usr/bin/env python | |
from subprocess import check_output, Popen, PIPE, call | |
import re | |
list_sinks = Popen(['pacmd', 'list-sinks'], stdout=PIPE) | |
output = str(check_output(['grep', r"index:"], stdin=list_sinks.stdout)) | |
list_sinks.wait() | |
selected = None | |
sinks = [] | |
for index_line in output.split(r'\n')[:-1]: |
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
require 'torch' | |
require 'utils' | |
require 'math' | |
require 'table' | |
tablex = require 'pl/tablex' | |
TensorType = torch.Tensor | |
function copy(x) | |
return TensorType(x:size()):copy(x) |