def preprocessor_laplacianeigenmaps_modular(data,k):
	from shogun.Features import RealFeatures
	from shogun.Preprocessor import LaplacianEigenmaps
	
	features = RealFeatures(data)
		
	preprocessor = LaplacianEigenmaps()
	preprocessor.set_target_dim(1)
	preprocessor.set_k(k)
	preprocessor.set_tau(2.0)
	preprocessor.apply_to_feature_matrix(features)

	return features
Esempio n. 2
0
lisomap.set_k(9)
preprocs.append((lisomap, "K-LIsomap with k=%d, %d landmarks" %
                 (lisomap.get_k(), lisomap.get_landmark_number())))

from shogun.Preprocessor import HessianLocallyLinearEmbedding
hlle = HessianLocallyLinearEmbedding()
hlle.set_k(6)
preprocs.append((hlle, "Hessian LLE with k=%d" % (hlle.get_k())))

from shogun.Preprocessor import LocalTangentSpaceAlignment
ltsa = LocalTangentSpaceAlignment()
ltsa.set_k(6)
preprocs.append((ltsa, "LTSA with k=%d" % (ltsa.get_k())))

from shogun.Preprocessor import LaplacianEigenmaps
le = LaplacianEigenmaps()
le.set_k(15)
le.set_tau(25.0)
preprocs.append(
    (le, "Laplacian Eigenmaps with k=%d, tau=%d" % (le.get_k(), le.get_tau())))

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

fig = plt.figure()
swiss_roll_fig = fig.add_subplot(3, 3, 1, projection='3d')
swiss_roll_fig.scatter(X[0], X[1], X[2], s=10, c=tt, cmap=plt.cm.Spectral)
plt.subplots_adjust(hspace=0.4)

from shogun.Features import RealFeatures