This file contains hidden or 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 | |
""" | |
dump-es | |
""" | |
import json | |
import argparse | |
from elasticsearch import Elasticsearch | |
from elasticsearch.helpers import scan |
This file contains hidden or 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
CC=g++ | |
CFLAGS=-fPIC -m64 -Wall -g -O3 -mavx -msse4 -mpopcnt -fopenmp -Wno-sign-compare -std=c++11 -fopenmp | |
LDFLAGS=-g -fPIC -fopenmp | |
# common linux flags | |
SHAREDEXT=so | |
SHAREDFLAGS=-shared | |
FAISSSHAREDFLAGS=-shared |
This file contains hidden or 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 | |
""" | |
latlon2cartesian.py | |
!! These are parameterized differently than stuff listed in textbooks... | |
!!!!!! gist `bkj/latlon2cartesian-new.py` has better API | |
""" |
This file contains hidden or 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 | |
from snapvx import * | |
from cvxpy import * | |
import time | |
np.random.seed(123) | |
num_nodes = 2000 | |
node_deg = 3 |
This file contains hidden or 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
from __future__ import division | |
import numpy as np | |
def mut_info(X, y): | |
n = X.shape[0] | |
n_11 = np.asarray(X[y].sum(axis=0)).squeeze() | |
n_01 = np.asarray(X[~y].sum(axis=0)).squeeze() | |
n_10 = np.asarray(y.sum() - n_11).squeeze() | |
n_00 = np.asarray(n - n_11 - n_01 - n_10).squeeze() |
This file contains hidden or 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 | |
import re | |
import string | |
import numpy as np | |
from sklearn.feature_extraction.text import CountVectorizer | |
import torch | |
from torch import nn |
This file contains hidden or 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 | |
""" | |
bow2adjlist.py | |
Convert a sparse matrix (eg term-document matrix) to two dense matrices | |
Useful for feeding into BOW models | |
""" |
This file contains hidden or 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 | |
""" | |
pytorch-dask.py | |
""" | |
import torch | |
from torch import nn | |
from torch.nn import functional as F |
This file contains hidden or 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 | |
""" | |
auction-lap.py | |
From | |
https://dspace.mit.edu/bitstream/handle/1721.1/3265/P-2108-26912652.pdf;sequence=1 | |
""" | |
from __future__ import print_function, division |
This file contains hidden or 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 | |
""" | |
sgdr.py | |
Code to reproduce Fig. 1 from https://arxiv.org/pdf/1608.03983.pdf | |
""" | |
import numpy as np |