def preprocessor_landmarkmds_modular(data):
    from shogun.Features import RealFeatures
    from shogun.Preprocessor import LandmarkMDS

    features = RealFeatures(data)

    preprocessor = LandmarkMDS()
    preprocessor.set_target_dim(1)
    preprocessor.apply_to_feature_matrix(features)

    return features
def preprocessor_landmarkmds_modular(data):
    from shogun.Features import RealFeatures
    from shogun.Preprocessor import LandmarkMDS

    features = RealFeatures(data)

    preprocessor = LandmarkMDS()
    preprocessor.set_target_dim(1)
    preprocessor.apply_to_feature_matrix(features)

    return features
示例#3
0
文件: swissroll.py 项目: orico/shogun
tt = numpy.genfromtxt('../../../../../data/toy/swissroll_color.dat',unpack=True).T
X = numpy.genfromtxt('../../../../../data/toy/swissroll.dat',unpack=True).T
N = X.shape[1]
preprocs = []

from shogun.Preprocessor import LocallyLinearEmbedding
lle = LocallyLinearEmbedding()
lle.set_k(9)
preprocs.append((lle, "Locally Linear Embedding with k=%d" % lle.get_k()))

from shogun.Preprocessor import ClassicMDS
mds = ClassicMDS()
preprocs.append((mds, "Classic MDS"))

from shogun.Preprocessor import LandmarkMDS
lmds = LandmarkMDS()
lmds.set_landmark_number(50)
preprocs.append((lmds,"Landmark MDS with %d landmarks" % lmds.get_landmark_number()))

from shogun.Preprocessor import ClassicIsomap, KISOMAP
cisomap = ClassicIsomap()
cisomap.set_type(KISOMAP)
cisomap.set_k(9)
preprocs.append((cisomap,"Classic K-Isomap with k=%d" % cisomap.get_k()))

from shogun.Preprocessor import LandmarkIsomap
lisomap = LandmarkIsomap()
lisomap.set_landmark_number(50)
lisomap.set_type(KISOMAP)
lisomap.set_k(9)
preprocs.append((lisomap,"L-K-Isomap with k=%d, %d landmarks" % (lisomap.get_k(),lisomap.get_landmark_number())))
示例#4
0
                      unpack=True).T
X = numpy.genfromtxt('../../../../../data/toy/swissroll.dat', unpack=True).T
N = X.shape[1]
preprocs = []

from shogun.Preprocessor import LocallyLinearEmbedding
lle = LocallyLinearEmbedding()
lle.set_k(9)
preprocs.append((lle, "LLE with k=%d" % lle.get_k()))

from shogun.Preprocessor import ClassicMDS
mds = ClassicMDS()
preprocs.append((mds, "Classic MDS"))

from shogun.Preprocessor import LandmarkMDS
lmds = LandmarkMDS()
lmds.set_landmark_number(20)
preprocs.append((lmds, "LMDS with %d landmarks" % lmds.get_landmark_number()))

from shogun.Preprocessor import ClassicIsomap
cisomap = ClassicIsomap()
cisomap.set_k(9)
preprocs.append((cisomap, "K-Isomap with k=%d" % cisomap.get_k()))

from shogun.Preprocessor import LandmarkIsomap
lisomap = LandmarkIsomap()
lisomap.set_landmark_number(500)
lisomap.set_k(9)
preprocs.append((lisomap, "K-LIsomap with k=%d, %d landmarks" %
                 (lisomap.get_k(), lisomap.get_landmark_number())))