def main(): Xtrain, Ytrain, Xtest, Ytest = getKaggleMNIST() dae = DeepAutoEncoder([500, 300, 2]) dae.fit(Xtrain) mapping = dae.map2center(Xtrain) plt.scatter(mapping[:, 0], mapping[:, 1], c=Ytrain, s=100, alpha=0.5) plt.show() # purity measure from unsupervised machine learning pt 1 _, Rfull = gmm(X, 10, max_iter=30) print "full purity:", purity(Y, Rfull) _, Rreduced = plot_k_means(Z, 10, max_iter=30) print "reduced purity:", purity(Y, Rreduced)
def main(): Xtrain, Ytrain, Xtest, Ytest = getKaggleMNIST() dae = DeepAutoEncoder([500, 300, 2]) dae.fit(Xtrain) mapping = dae.map2center(Xtrain) plt.scatter(mapping[:, 0], mapping[:, 1], c=Ytrain, s=100, alpha=0.5) plt.show() # purity measure from unsupervised machine learning pt 1 gmm = GaussianMixture(n_components=10) gmm.fit(Xtrain) responsibilities_full = gmm.predict_proba(Xtrain) print "full purity:", purity(Ytrain, responsibilities_full) gmm.fit(mapping) responsibilities_reduced = gmm.predict_proba(mapping) print "reduced purity:", purity(Ytrain, responsibilities_reduced)
def main(): Xtrain, Ytrain, _, _ = getKaggleMNIST() sample_size = 1000 X = Xtrain[:sample_size] Y = Ytrain[:sample_size] tsne = TSNE() Z = tsne.fit_transform(X) plt.scatter(Z[:, 0], Z[:, 1], s=100, c=Y, alpha=0.5) plt.show() # purity measure from unsupervised machine learning pt 1 _, Rfull = gmm(X, 10, max_iter=30, smoothing=10e-1) print "full purity:", purity(Y, Rfull) _, Rreduced = gmm(Z, 10, max_iter=30, smoothing=10e-1) print "reduced purity:", purity(Y, Rreduced)
def main(): Xtrain, Ytrain, Xtest, Ytest = getKaggleMNIST() dae = DeepAutoEncoder([500, 300, 2]) dae.fit(Xtrain) mapping = dae.map2center(Xtrain) plt.scatter(mapping[:,0], mapping[:,1], c=Ytrain, s=100, alpha=0.5) plt.show() # purity measure from unsupervised machine learning pt 1 gmm = GaussianMixture(n_components=10) gmm.fit(Xtrain) responsibilities_full = gmm.predict_proba(Xtrain) print "full purity:", purity(Ytrain, responsibilities_full) gmm.fit(mapping) responsibilities_reduced = gmm.predict_proba(mapping) print "reduced purity:", purity(Ytrain, responsibilities_reduced)
def main(): Xtrain, Ytrain, _, _ = getKaggleMNIST() sample_size = 1000 X = Xtrain[:sample_size] Y = Ytrain[:sample_size] tsne = TSNE() Z = tsne.fit_transform(X) plt.scatter(Z[:,0], Z[:,1], s=100, c=Y, alpha=0.5) plt.show() # purity measure from unsupervised machine learning pt 1 _, Rfull = gmm(X, 10, max_iter=30, smoothing=10e-1) print "full purity:", purity(Y, Rfull) _, Rreduced = gmm(Z, 10, max_iter=30, smoothing=10e-1) print "reduced purity:", purity(Y, Rreduced)
def main(): Xtrain, Ytrain, Xtest, Ytest = getKaggleMNIST() dae = DeepAutoEncoder([500, 300, 2]) dae.fit(Xtrain) mapping = dae.map2center(Xtrain) plt.scatter(mapping[:, 0], mapping[:, 1], c=Ytrain, s=100, alpha=0.5) plt.show() # purity measure from unsupervised machine learning pt 1 # NOTE: this will take a long time (i.e. just leave it overnight) gmm = GaussianMixture(n_components=10) gmm.fit(Xtrain) print("Finished GMM training") responsibilities_full = gmm.predict_proba(Xtrain) print("full purity:", purity(Ytrain, responsibilities_full)) gmm.fit(mapping) responsibilities_reduced = gmm.predict_proba(mapping) print("reduced purity:", purity(Ytrain, responsibilities_reduced))
def main(): Xtrain, Ytrain, Xtest, Ytest = getKaggleMNIST() dae = DeepAutoEncoder([500, 300, 2]) dae.fit(Xtrain) mapping = dae.map2center(Xtrain) plt.scatter(mapping[:,0], mapping[:,1], c=Ytrain, s=100, alpha=0.5) plt.show() # purity measure from unsupervised machine learning pt 1 # NOTE: this will take a long time (i.e. just leave it overnight) gmm = GaussianMixture(n_components=10) gmm.fit(Xtrain) print("Finished GMM training") responsibilities_full = gmm.predict_proba(Xtrain) print("full purity:", purity(Ytrain, responsibilities_full)) gmm.fit(mapping) responsibilities_reduced = gmm.predict_proba(mapping) print("reduced purity:", purity(Ytrain, responsibilities_reduced))
def main(): Xtrain, Ytrain, _, _ = getKaggleMNIST() sample_size = 1000 X = Xtrain[:sample_size] Y = Ytrain[:sample_size] tsne = TSNE() Z = tsne.fit_transform(X) plt.scatter(Z[:, 0], Z[:, 1], s=100, c=Y, alpha=0.5) plt.show() # purity measure from unsupervised machine learning pt 1 # maximum purity is 1, higher is better gmm = GaussianMixture(n_components=10) gmm.fit(X) Rfull = gmm.predict_proba(X) print("Rfull.shape:", Rfull.shape) print("full purity:", purity(Y, Rfull)) # now try the same thing on the reduced data gmm.fit(Z) Rreduced = gmm.predict_proba(Z) print("reduced purity:", purity(Y, Rreduced))
def main(): Xtrain, Ytrain, Xtest, Ytest = getKaggleMNIST() dae = DeepAutoEncoder([500, 300, 2]) dae.fit(Xtrain) mapping = dae.map2center(Xtrain) plt.scatter(mapping[:,0], mapping[:,1], c=Ytrain, s=100, alpha=0.5) plt.show() # purity measure from unsupervised machine learning pt 1 <<<<<<< HEAD gmm = GaussianMixture(n_components=10) gmm.fit(Xtrain) responsibilities_full = gmm.predict_proba(Xtrain) print "full purity:", purity(Ytrain, responsibilities_full) gmm.fit(mapping) responsibilities_reduced = gmm.predict_proba(mapping) print "reduced purity:", purity(Ytrain, responsibilities_reduced) ======= # NOTE: this will take a long time (i.e. just leave it overnight) gmm = GaussianMixture(n_components=10) gmm.fit(Xtrain) print("Finished GMM training") responsibilities_full = gmm.predict_proba(Xtrain) print("full purity:", purity(Ytrain, responsibilities_full)) gmm.fit(mapping) responsibilities_reduced = gmm.predict_proba(mapping) print("reduced purity:", purity(Ytrain, responsibilities_reduced))
def main(): Xtrain, Ytrain, _, _ = getKaggleMNIST() sample_size = 1000 X = Xtrain[:sample_size] Y = Ytrain[:sample_size] tsne = TSNE() Z = tsne.fit_transform(X) plt.scatter(Z[:,0], Z[:,1], s=100, c=Y, alpha=0.5) plt.show() # purity measure from unsupervised machine learning pt 1 <<<<<<< HEAD _, Rfull = gmm(X, 10, max_iter=30, smoothing=10e-1) print "full purity:", purity(Y, Rfull) _, Rreduced = gmm(Z, 10, max_iter=30, smoothing=10e-1) print "reduced purity:", purity(Y, Rreduced) ======= # maximum purity is 1, higher is better gmm = GaussianMixture(n_components=10) gmm.fit(X) Rfull = gmm.predict_proba(X) print("Rfull.shape:", Rfull.shape) print("full purity:", purity(Y, Rfull)) # now try the same thing on the reduced data gmm.fit(Z) Rreduced = gmm.predict_proba(Z) print("reduced purity:", purity(Y, Rreduced)) >>>>>>> upstream/master