Example #1
0
import numpy as np
import load_word_vecs as word_vecs
from sklearn.decomposition import PCA
# import matplotlib.pyplot as plt
# from mpl_toolkits.mplot3d import Axes3D
import test_bigrams as tb
import matplotlib
import pylab as pl

import train_neural_network as tnn


if __name__ == '__main__':
	vecs = word_vecs.load("../data/vectors.txt")
	labels, wordVecsMatrix = word_vecs.get_matrix(vecs)
	pca = PCA(n_components=2)


	# pca.fit(wordVecsMatrix);
	# reduced_X = pca.transform(wordVecsMatrix)

	# print "Running PCA"
	# pca = PCA(n_components=2)
	# pca.fit(wordVecsMatrix);
	# reduced_X = pca.transform(wordVecsMatrix)
	# fig = pl.figure()
	# ax = fig.add_subplot(111, projection='3d')

	#plot full data
	# ax.scatter(reduced_X[:, 0], reduced_X[:, 1], reduced_X[:, 2])
Example #2
0
#!/usr/bin/env python

import numpy as np
import load_word_vecs as word_vecs
from sklearn.decomposition import PCA
# import matplotlib.pyplot as plt
# from mpl_toolkits.mplot3d import Axes3D
import test_bigrams as tb
import matplotlib
import pylab as pl

import train_neural_network as tnn

if __name__ == '__main__':
    vecs = word_vecs.load("../data/vectors.txt")
    labels, wordVecsMatrix = word_vecs.get_matrix(vecs)
    pca = PCA(n_components=2)

    # pca.fit(wordVecsMatrix);
    # reduced_X = pca.transform(wordVecsMatrix)

    # print "Running PCA"
    # pca = PCA(n_components=2)
    # pca.fit(wordVecsMatrix);
    # reduced_X = pca.transform(wordVecsMatrix)
    # fig = pl.figure()
    # ax = fig.add_subplot(111, projection='3d')

    #plot full data
    # ax.scatter(reduced_X[:, 0], reduced_X[:, 1], reduced_X[:, 2])
    # plt.show()
Example #3
0
#!/usr/bin/env python
import numpy as np
import load_word_vecs as word_vecs
import bh_tsne.bhtsne as tsne

if __name__ == '__main__':
	labels, wordVecsMatrix = word_vecs.get_matrix(word_vecs.load("../data/vectors.txt"))

	# #runs tsne on wordVecsMatrix (change if we want to just look at some subset of the bigrams)
	points = tsne.bh_tsne(wordVecsMatrix);
	# np.save("../data/tsne_coordinates", points);
Example #4
0
#!/usr/bin/env python
import numpy as np
import load_word_vecs as word_vecs
import bh_tsne.bhtsne as tsne

if __name__ == '__main__':
    labels, wordVecsMatrix = word_vecs.get_matrix(
        word_vecs.load("../data/vectors.txt"))

    # #runs tsne on wordVecsMatrix (change if we want to just look at some subset of the bigrams)
    points = tsne.bh_tsne(wordVecsMatrix)
    # np.save("../data/tsne_coordinates", points);