Skip to content

Instantly share code, notes, and snippets.

1) Create Word Embedding using Glove
model_glove = word2vec.Word2Vec(word2vec_sentences, size=200, window=10, sg=1, hs=0, min_count=1, negative=10, workers=-1, iter=5)
2)from sklearn.cluster import AgglomerativeClustering
----------------to form cluster use this ------------------
In [37]:
wv_clusters = AgglomerativeClustering(n_clusters=50, affinity="cosine", linkage="average")
In [38]:
wv_clusters.fit(model_label_specific.syn0norm)
@bhushanbrb
bhushanbrb / gist:ff2bb2324365f61575919f777f790bd8
Created August 15, 2018 16:22
DecisionTree_Demo_SparkCode
from __future__ import division
import operator
from pyspark import SparkContext
from pyspark.sql import SQLContext
from pyspark.sql.functions import col
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
sc = SparkContext("local", "Decision Tree")
#%matplotlib notebook
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import colors as c
import time
fig = plt.figure()
ax = fig.gca()
@bhushanbrb
bhushanbrb / sublime-command-line.md
Created August 26, 2019 18:11 — forked from adrianorsouza/sublime-command-line.md
launch sublime text from the command line

Launch Sublime Text from the command line on OSX

Sublime Text includes a command line tool, subl, to work with files on the command line. This can be used to open files and projects in Sublime Text, as well working as an EDITOR for unix tools, such as git and subversion.

Requirements

  • Sublime text 2 or 3 installed in your system within Applications folder

Setup

@bhushanbrb
bhushanbrb / sublime-command-line.md
Created August 26, 2019 18:11 — forked from adrianorsouza/sublime-command-line.md
launch sublime text from the command line

Launch Sublime Text from the command line on OSX

Sublime Text includes a command line tool, subl, to work with files on the command line. This can be used to open files and projects in Sublime Text, as well working as an EDITOR for unix tools, such as git and subversion.

Requirements

  • Sublime text 2 or 3 installed in your system within Applications folder

Setup

We can't make this file beautiful and searchable because it's too large.
-0.01206152 -0.095134005 0.08669477 0.05619071 -0.17349663 -0.09935912 0.014213995 -0.19455107 0.07484186 -0.011342624 -0.10063104 -0.10237787 -0.08157693 0.11342965 -0.08353989 -0.11223511 0.0019628236 0.071215674 0.082265 0.041478932 -0.09615726 0.15515359 0.001832584 -0.023677984 -0.05058938 -0.08042582 -0.07134956 0.0017479308 0.033818293 0.063889556 -0.007369788 -0.05243679 0.07423341 -0.019891761 -0.0067004883 -0.23559321 -0.06612133 0.13619603 0.08681691 0.017568786 0.026499353 0.08512451 0.08734439 -0.012464411 0.076167226 0.021450328 -0.009330892 -0.057661034 -0.1142646 -0.07418265 -0.15135011 0.23188408 -0.14348044 0.06404558 -0.053029064 0.023797784 -0.0060387813 -0.105671816 0.15697628 0.029772412 0.043924283 0.15058309 0.015849171 0.18724196 0.03822962 -0.066418976 -0.00027408544 -0.06806309 -0.09658261 0.0076671415 0.0051623024 0.016508697 -0.071227066 -0.08391313 0.1335714 -0.07820776 0.024546726 0.07157335 -0.044634536 -0.0069277463 0.0026915965 -0.019091828 0.10273607 0.06872933 0.15480886 -0
We can make this file beautiful and searchable if this error is corrected: No tabs found in this TSV file in line 0.
8 ft x 11 16 x 11 16 polymer outside corner moulding
blank house key
supreme undermount stainless steel 16 single bowl kitchen sink
9 16 x 1 5 8 x 8 ft pvc composite white crown moulding
coralai single handle pull sprayer kitchen faucet masterclean sprayface biscuit
mariposa 5 ft right hand drain acrylic soaking tub white
polyethylene side guide 10 pack
30 amp 600 volt dual element class rk5 fuse
signature drop stainless steel 25 4 hole single bowl kitchen sink 10 5 bowl
4 pvc dwv saddle tee kit
@bhushanbrb
bhushanbrb / tf
Last active April 14, 2020 05:33
{
"embeddings": [
{
"tensorName": "My tensor",
"tensorShape": [
1000,
50
],
"tensorPath":"https://gist.githubusercontent.com/bhushanbrb/952a29e2cb046ae7b74e9ad7d2ca2972/raw/a1f528d5da44352a794cd8af373e72bb4d64188c/pred.tsv",
"metadataPath":"https://gist.githubusercontent.com/bhushanbrb/1c50fcf13f0eb034c1cb28b1607939ab/raw/573f15f926b672c3eb2cde849f02d3665a8d2be6/omsid.tsv"
{
"embeddings": [
{
"tensorName": "Vector Search with pictures and queries",
"tensorShape": [
3000,
128
],
"tensorPath": "https://gist.githubusercontent.com/MariaFjodorowa/68277095197a798f8aa02c59f35df234/raw/28d4fda62828833834c59f19910f4c980e822d23/vecs_queries_prod.tsv",
"metadataPath": "https://gist.githubusercontent.com/MariaFjodorowa/f9db18927d1b6f45bf9d1e61ff56fa4b/raw/19025a9223c41e45ccebb35e82ab59ed2e7b1fc4/meta_queries_prod.tsv",

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-autosuggestions by