Skip to content

Instantly share code, notes, and snippets.

View KinglittleQ's full-sized avatar
🍦

Chengqi Deng KinglittleQ

🍦
  • Zhejiang University
  • hangzhou
View GitHub Profile
@KinglittleQ
KinglittleQ / bench.ipynb
Last active April 11, 2022 23:56
bench_quantizer
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@KinglittleQ
KinglittleQ / entropy.py
Created March 31, 2021 07:50
Compute entropy, KL divergence and cross entropy
import math
import numpy as np
def entropy(P):
assert P.ndim == 1
H = np.sum(-P * np.log(P))
return H
@KinglittleQ
KinglittleQ / vis_data.py
Last active April 1, 2021 14:25
Visualize anns datasets
import time
import sys
import numpy as np
import faiss
import sklearn
from sklearn.manifold import TSNE
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
from faiss.contrib.datasets import (