Instantly share code, notes, and snippets.

• Sort options
Created Aug 8, 2019
View word_math.py
 # assigns the row from the embedding matrix to the named variable king = embed_matrix[word_to_index['king']] male = embed_matrix[word_to_index[‘male’]] female = embed_matrix[word_to_index[‘female']] queen = embed_matrix[word_to_index['queen']] # the formula now uses the vectors from the embedding matrix assert (king - man) + woman ≈ queen
Last active Aug 20, 2019
A sample word2index generated in python.
View word2index.py
 """ # The map word | idx ---------------- king | 0 male | 1 queen | 2 female | 3 """
Last active Aug 8, 2019
A sample embedding matrix
View sample_embeddings.txt
 idx | embed_matrix 0 [[ 0.21143426, 1.2885487 , 0.98160927, 0.17858341], 1 [-0.38735983, 0.06507064, 1.31839592, -0.91412724], 2 [ 1.13726889, 0.48327542, 0.65075236, 0.93818869], 3 [1.73606298, 1.70675348, 0.31396571, 2.03089933]]
Created Aug 4, 2019
TestGist
View make_blob.py
 import numpy as np def make_blob_part(mean, cov, num_points=500): x, y = np.random.multivariate_normal(mean, cov, num_points).T return np.hstack((x.reshape(-1, 1), y.reshape(-1, 1))) mean1 = [-10, 10] mean2 = [-15, 5] mean3 = [-9, 3]
Created Oct 24, 2018
How to find all new files you've added to a branch
View find_new_files.txt
 git diff {old_branch}...{new_branch} --name-status --diff-filter=A e.g. to find a enw file added since branching from master: git diff master...gradie/sandbox --name-status --diff-filter=A Options for `--diff-filter Added (A) Copied (C)
Created Apr 3, 2018
Force pull - overwrite with content from origin
View reset_branch.txt
 git fetch --all git reset --hard origin/{branch_name}
You can’t perform that action at this time.