Skip to content

Instantly share code, notes, and snippets.

@alexklibisz
alexklibisz / lsh.py
Created May 24, 2018 05:02
ElastiK-Nearest-Neighbors LSH Example
import numpy as np
def make_lsh_model(nb_tables, nb_bits, nb_dimensions, vector_sample):
# vector_sample: np arr w/ shape (2 * nb_tables * nb_tables, nb_dimensions).
# normals, midpoints: np arrs w/ shape (nb_bits, nb_dimensions)
# thresholds: np arrs w/ shape (nb_bits)
# all_normals, all_thresholds: lists w/ one normal, one threshold per table.
all_normals, all_thresholds = [], []
for i in range(0, len(vector_sample), 2 * nb_bits):
vector_sample_a = vector_sample[i:i + nb_bits]

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: