当前位置: 首页>>代码示例>>Python>>正文


Python Isomap.transform方法代码示例

本文整理汇总了Python中sklearn.manifold.Isomap.transform方法的典型用法代码示例。如果您正苦于以下问题:Python Isomap.transform方法的具体用法?Python Isomap.transform怎么用?Python Isomap.transform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sklearn.manifold.Isomap的用法示例。


在下文中一共展示了Isomap.transform方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ISOMAP_transform

# 需要导入模块: from sklearn.manifold import Isomap [as 别名]
# 或者: from sklearn.manifold.Isomap import transform [as 别名]
def ISOMAP_transform(train_feature, test_feature, n_components, n_neighbors = 5):
    """ ISOMAP method
    """
    from sklearn.manifold import Isomap
    isomap = Isomap(n_neighbors, n_components).fit(train_feature)
    
    train_feature_transformed = isomap.transform(train_feature)
    test_feature_transformed = isomap.transform(test_feature)
    
    return train_feature_transformed, test_feature_transformed
开发者ID:hitalex,项目名称:CCDM2014-contest,代码行数:12,代码来源:dimension_reduction.py

示例2: dimension_reduce

# 需要导入模块: from sklearn.manifold import Isomap [as 别名]
# 或者: from sklearn.manifold.Isomap import transform [as 别名]
def dimension_reduce():
    ''' This compares a few different methods of
    dimensionality reduction on the current dataset.
    '''
    pca = PCA(n_components=2)                             # initialize a dimensionality reducer
    pca.fit(digits.data)                                  # fit it to our data
    X_pca = pca.transform(digits.data)                    # apply our data to the transformation
    plt.subplot(1, 3, 1)
    plt.scatter(X_pca[:, 0], X_pca[:, 1], c=digits.target)# plot the manifold
    
    se = SpectralEmbedding()
    X_se = se.fit_transform(digits.data)
    plt.subplot(1, 3, 2)
    plt.scatter(X_se[:, 0], X_se[:, 1], c=digits.target)
    
    isomap = Isomap(n_components=2, n_neighbors=20)
    isomap.fit(digits.data)
    X_iso = isomap.transform(digits.data)
    plt.subplot(1, 3, 3)
    plt.scatter(X_iso[:, 0], X_iso[:, 1], c=digits.target)
    plt.show()

    plt.matshow(pca.mean_.reshape(8, 8))                  # plot the mean components
    plt.matshow(pca.components_[0].reshape(8, 8))         # plot the first principal component
    plt.matshow(pca.components_[1].reshape(8, 8))         # plot the second principal component
    plt.show()
开发者ID:bashwork,项目名称:common,代码行数:28,代码来源:digits.py

示例3: __init__

# 需要导入模块: from sklearn.manifold import Isomap [as 别名]
# 或者: from sklearn.manifold.Isomap import transform [as 别名]
class FloorplanEstimator:
    """
    Simple estimator for rough floorplans
    """
    def __init__(self):
        """
        Instantiate floorplan estimator
        """
        self.dimred = Isomap(n_neighbors=25, n_components=2)
        self._fingerprints = None
        self._label = None

    def fit(self, fingerprints, label):
        """
        Estimate floorplan from labeled fingerprints
        :param fingerprints: list of fingerprints
        :param label: list of corresponding labels
        """
        self.dimred.fit(fingerprints)
        self._fingerprints = fingerprints
        self._label = label

    def transform(self, fingerprints):
        """
        Get x,y coordinates of fingerprints on floorplan
        :param fingerprints: list of fingerprints
        :return: list of [x,y] coordinates
        """
        return self.dimred.transform(fingerprints)

    def draw(self):
        """
        Draw the estimated floorplan in the current figure
        """
        xy = self.dimred.transform(self._fingerprints)

        x_min, x_max = xy[:,0].min(), xy[:,0].max()
        y_min, y_max = xy[:,1].min(), xy[:,1].max()
        xx, yy = np.meshgrid(np.arange(x_min, x_max, 1.0),
                             np.arange(y_min, y_max, 1.0))
        clf = RadiusNeighborsClassifier(radius=3.0, outlier_label=0)
        clf.fit(xy, self._label)
        label = clf.predict(np.c_[xx.ravel(), yy.ravel()]).reshape(xx.shape)

        plt.pcolormesh(xx, yy, label)
        plt.scatter(xy[:,0], xy[:,1], c=self._label, vmin=0)
开发者ID:tomvand,项目名称:fingerprint-localization,代码行数:48,代码来源:fpFloorplan.py

示例4: compute_iso_map

# 需要导入模块: from sklearn.manifold import Isomap [as 别名]
# 或者: from sklearn.manifold.Isomap import transform [as 别名]
 def compute_iso_map(self, original_features):
   feature_matrix = original_features.drop('file', 1).as_matrix()
   feature_matrix = np.nan_to_num(feature_matrix)
   
   dimen_reductor = Isomap(n_components=self.n_components)
   
   full_size = feature_matrix.shape[0]
   train_size = int(self.ratio * full_size)
   
   row_indices = list(range(full_size))
   feature_training_indices = np.random.choice(row_indices, size = train_size)
   training_feature_matrix = feature_matrix[feature_training_indices, :]
   
   dimen_reductor.fit(training_feature_matrix)    
   reduced_features = dimen_reductor.transform(feature_matrix)
   
   reduced_normalized_features = reduced_features - reduced_features.min(axis=0)
   reduced_normalized_features /= reduced_normalized_features.max(axis=0)
   
   return reduced_normalized_features
开发者ID:tcoatale,项目名称:cnn_framework,代码行数:22,代码来源:isomap_extractor.py

示例5: isoMap

# 需要导入模块: from sklearn.manifold import Isomap [as 别名]
# 或者: from sklearn.manifold.Isomap import transform [as 别名]
def isoMap(X, y):
	im = Isomap(n_components = 1, eigen_solver = "dense", n_neighbors = 20)
	im.fit(X)
	transformX = im.transform(X)
	return transformX
开发者ID:BIDS-collaborative,项目名称:EDAM,代码行数:7,代码来源:predict.py

示例6: PCA

# 需要导入模块: from sklearn.manifold import Isomap [as 别名]
# 或者: from sklearn.manifold.Isomap import transform [as 别名]
#maxabsscaler = pp.MaxAbsScaler()
#maxabsscaler.fit(X)
#X = maxabsscaler.transform(X)
#print('MaxAbsScaler\n========')

#X = pp.normalize(X)
#print('normalizer\n========')

# TODO: Use PCA to reduce noise, n_components 4-14

nc = 5
#pca = PCA(n_components=nc)
#pca.fit(X)
#X = pca.transform(X)
#print('PCA: ', nc)

# Use Isomap to reduce noise, n_neighbors 2-5
nn = 4
im = Isomap(n_neighbors=nn, n_components=nc)
im.fit(X)
X = im.transform(X)
print('Isomap: ',nn, ' comp: ', nc)

# TODO: train_test_split 30% and random_state=7

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=7)

# TODO: Create an SVC, train and score against defaults
result = findMaxSVC()
print(result['score'])
开发者ID:griblik,项目名称:scratch,代码行数:32,代码来源:assignment3.py

示例7: PCA

# 需要导入模块: from sklearn.manifold import Isomap [as 别名]
# 或者: from sklearn.manifold.Isomap import transform [as 别名]
scaler.fit(X_train)
X_train = scaler.transform(X_train)
X_test = scaler.transform(X_test)

#pcaComponent = 4
#pca = PCA(n_components=pcaComponent)
#pca.fit(X_train)
#X_train = pca.transform(X_train)
#X_test = pca.transform(X_test)

neighbors = 2
components = 4
isomap = Isomap(n_neighbors=neighbors, n_components=components)
isomap.fit(X_train)
X_train = isomap.transform(X_train)
X_test = isomap.transform(X_test)

#svc = SVC()
#svc.fit(X_train, y_train)
#print svc.score(X_test, y_test)

best_score = 0
best_C = 0
best_gamma = 0
for C in np.arange(0.05, 2.05, 0.05):
    for gamma in np.arange(0.001, 1.001, 0.001):
        svc = SVC(C = C, gamma = gamma)
        svc.fit(X_train, y_train)
        score = svc.score(X_test, y_test)
        if score > best_score:
开发者ID:anhualin,项目名称:MyLearning,代码行数:32,代码来源:ALi.py

示例8: main

# 需要导入模块: from sklearn.manifold import Isomap [as 别名]
# 或者: from sklearn.manifold.Isomap import transform [as 别名]
def main():
    #Load the dataset from Matlab
    data = sio.loadmat('baseline2.mat')
    n_train = int(data['n_train'])
    n_test = int(data['n_test'])
    train_x = np.array(data['train_x'])
    train_t = np.array(data['train_t']).reshape(n_train)
    test_x = np.array(data['test_x'])
    test_t = np.array(data['test_t']).reshape(800)
    X_indices = np.arange(train_x.shape[-1])

    #SVM Fitting
    C = [-10,5,10]
    G = [-10,5,10]
    CF = [-10,5,10]

    # Plot the cross-validation score as a function of percentile of features
    NG = [10,20,50,100,200]
    components = (10,20,50,100,200)
    scores = list()
    svcs = list()
    isos = list()

    for cc in components:
        for nn in NG:
            best_c = 0
            best_g = 0
            best_cf = 0
            best_iso = None
            max_score = -np.inf

            iso = Isomap(n_components=cc, n_neighbors=nn)
            iso.fit(train_x)
            train = iso.transform(train_x)

            for c in C:
                for g in G:
                    for cf in CF:
                        #Find best C, gamma
                        svc = svm.SVC(C=2**c, gamma=2**g, coef0=2**cf, degree=3, kernel='poly',max_iter=1000000)
                        this_scores = cross_validation.cross_val_score(svc, train, train_t, n_jobs=-1, cv=5, scoring='accuracy')
                        mean_score = sum(this_scores)/len(this_scores)

                        print("C: "+str(c)+" G: "+str(g)+" CMPS: "+str(cc)+" A: "+str(mean_score) + " CF: " +str(cf) + "N: "+str(nn))

                        if mean_score > max_score:
                            max_score = mean_score
                            best_svm = svc
                            best_iso = iso
            svcs.append(best_svm)
            isos.append(best_iso)
            scores.append(max_score)

    m_ind =  scores.index(max(scores))
    best_s = svcs[m_ind]
    iso = isos[m_ind]

    # Test final model
    test = iso.transform(test_x)
    train = iso.transform(train_x)
    best_s.fit(train,train_t)

    pred = best_s.predict(test)
    sio.savemat('predicted_iso.mat',dict(x=range(800),pred_t=pred))

    final_score = best_s.score(test,test_t)
    print(best_s)
    print("Final Accuracy: "+str(final_score))
    print(scores)
开发者ID:Sessa93,项目名称:MLProject,代码行数:71,代码来源:isomap.py

示例9: Isomap

# 需要导入模块: from sklearn.manifold import Isomap [as 别名]
# 或者: from sklearn.manifold.Isomap import transform [as 别名]
from sklearn.manifold import Isomap
from sklearn.decomposition import PCA
from sklearn import preprocessing
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from mpl_toolkits.mplot3d import Axes3D
import random
from colorsys import hsv_to_rgb


data = np.genfromtxt('data012.txt', delimiter=',')
isomap = Isomap()
data_xformed = isomap.fit_transform(data)
# pca = PCA(n_components=2)
# data_xformed = pca.fit_transform(data)
print data.shape
print data_xformed.shape
c = [(1,0,0)]*1000+[(0,1,0)]*1000+[(1,1,0)]*1000
plt.figure()
plt.scatter(data_xformed[:,0], data_xformed[:,1], c=c)
plt.show()
quit()

train_data = np.genfromtxt('training.txt', delimiter=',')
isomap = Isomap(n_components=4)
train_xformed = isomap.fit_transform(train_data)
test_data = np.genfromtxt('testing.txt', delimiter=',')
test_xformed = isomap.transform(test_data)
np.savetxt("isomap_training_reduced4.txt", train_xformed, delimiter=',')
np.savetxt("isomap_testing_reduced4.txt", test_xformed, delimiter=',')
开发者ID:ej48,项目名称:manifold-learning,代码行数:33,代码来源:isomap.py

示例10: CardiotocographyMainFrame

# 需要导入模块: from sklearn.manifold import Isomap [as 别名]
# 或者: from sklearn.manifold.Isomap import transform [as 别名]
class CardiotocographyMainFrame(Tk.Frame):
    def __init__(self, master, x_train, y_train, x_test, y_test, evaluator, console):
        Tk.Frame.__init__(self, master)
        self.evaluator = evaluator
        self.x_train = x_train
        self.y_train = y_train
        self.x_test = x_test
        self.y_test = y_test
        self.new_estimator = None
        self.console = console
        self.evaluator.load_data(x_train, y_train, x_test, y_test)
        self.evaluator.train()
        self.x_train_r = self.evaluator.reduce(x_train)  # 特征降维

        # 0. 优化按钮
        self.button_opt = Tk.Button(self, text="优化", command=self.optimize_parameter)
        self.button_opt.pack(side=Tk.TOP, anchor=Tk.E)
        self.label_tips = Tk.Label(self)
        self.label_tips.pack(side=Tk.TOP, anchor=Tk.E)

        # 1. 散点图
        frame_train = Tk.Frame(self)
        frame_train.pack(fill=Tk.BOTH, expand=1, padx=15, pady=15)
        self.figure_train = Figure(figsize=(5, 4), dpi=100)
        self.subplot_train = self.figure_train.add_subplot(111)
        self.subplot_train.set_title('Cardiotocography High-Dimension Data Visualization (21-dim)')
        self.figure_train.tight_layout()  # 一定要放在add_subplot函数之后,否则崩溃
        self.last_line = None

        self.tsne = Isomap(n_components=2, n_neighbors=10)
        np.set_printoptions(suppress=True)
        x_train_r = self.tsne.fit_transform(x_train)
        self.subplot_train.scatter(x_train_r[:, 0], x_train_r[:, 1], c=y_train, cmap=plt.cm.get_cmap("Paired"))
        self.attach_figure(self.figure_train, frame_train)

        y_pred = self.evaluator.pipeline.predict(x_train)
        accuracy = accuracy_score(y_true=y_train, y_pred=y_pred)

        self.console.output("[CTG] INIT MODEL: ", str(self.evaluator.pipeline.named_steps['clf']) + "\n")
        self.console.output("[CTG] INIT ACCURACY: ", str(accuracy) + "\n")

        # 2. 概率输出框
        frame_prob = Tk.Frame(self)
        frame_prob.pack(fill=Tk.BOTH, expand=1, padx=5, pady=5)
        Tk.Label(frame_prob, text="prob").pack(side=Tk.LEFT)
        self.strvar_prob1 = Tk.StringVar()
        Tk.Label(frame_prob, text="1.").pack(side=Tk.LEFT)
        Tk.Entry(frame_prob, textvariable=self.strvar_prob1, bd=5).pack(side=Tk.LEFT, padx=5, pady=5)

        self.strvar_prob2 = Tk.StringVar()
        Tk.Label(frame_prob, text="2.").pack(side=Tk.LEFT)
        Tk.Entry(frame_prob, textvariable=self.strvar_prob2, bd=5).pack(side=Tk.LEFT, padx=5, pady=5)

        self.strvar_prob3 = Tk.StringVar()
        Tk.Label(frame_prob, text="3.").pack(side=Tk.LEFT)
        Tk.Entry(frame_prob, textvariable=self.strvar_prob3, bd=5).pack(side=Tk.LEFT, padx=5, pady=5)

        # 3. 滑动条
        frame_slides = Tk.Frame(self)
        frame_slides.pack(fill=Tk.BOTH, expand=1, padx=5, pady=5)
        canv = Tk.Canvas(frame_slides, relief=Tk.SUNKEN)
        vbar = Tk.Scrollbar(frame_slides, command=canv.yview)
        canv.config(scrollregion=(0, 0, 300, 1500))
        canv.config(yscrollcommand=vbar.set)
        vbar.pack(side=Tk.RIGHT, fill=Tk.Y)
        canv.pack(side=Tk.LEFT, expand=Tk.YES, fill=Tk.BOTH)
        feature_num = x_train.shape[1]
        self.slides = [None] * feature_num  # 滑动条个数为特征个数
        for i in range(feature_num):
            canv.create_window(60, (i + 1) * 40, window=Tk.Label(canv, text=str(i + 1) + ". "))
            min_x = np.min(x_train[:, i])
            max_x = np.max(x_train[:, i])
            self.slides[i] = Tk.Scale(canv, from_=min_x, to=max_x, resolution=(max_x - min_x) / 100.0,
                                      orient=Tk.HORIZONTAL, command=self.predict)
            canv.create_window(200, (i + 1) * 40, window=self.slides[i])

    # 根据即特征值,计算归属类别的概率
    def predict(self, trivial):
        feature_num = self.x_train.shape[1]
        x = np.arange(feature_num, dtype='f').reshape((1, feature_num))
        for i in range(feature_num):
            x[0, i] = float(self.slides[i].get())
        result = self.evaluator.predict(x)
        self.strvar_prob1.set("%.2f%%" % (result[0, 0] * 100))  # 无病的概率
        self.strvar_prob2.set("%.2f%%" % (result[0, 1] * 100))  # 存疑的概率
        self.strvar_prob3.set("%.2f%%" % (result[0, 2] * 100))  # 确诊的概率
        self.plot_point(self.subplot_train, self.tsne.transform(x))
        self.figure_train.canvas.draw()

    # 重绘点
    def plot_point(self, subplot, x):
        if self.last_line is not None:
            self.last_line.remove()
            del self.last_line
        lines = subplot.plot(x[:, 0], x[:, 1], "ro", label="case")
        self.last_line = lines.pop(0)
        subplot.legend(loc='lower right')

    # 将figure放到frame上
    @staticmethod
#.........这里部分代码省略.........
开发者ID:vincent2610,项目名称:cancer-assessment,代码行数:103,代码来源:frame_main_ctg.py

示例11:

# 需要导入模块: from sklearn.manifold import Isomap [as 别名]
# 或者: from sklearn.manifold.Isomap import transform [as 别名]
            color_sample.append('r')
#
# TODO: Convert the list to a dataframe
#
# .. your code here .. 
df_images = pd.DataFrame(samples)
#df_images_t = df_images.transpose()

#
# TODO: Implement Isomap here. Reduce the dataframe df down
# to three components, using K=6 for your neighborhood size
#
# .. your code here .. 
iso_bear=Isomap(n_components=3,n_neighbors=6)
iso_bear.fit(df_images)
T_iso_bear = iso_bear.transform(df_images)

#
# TODO: Create a 2D Scatter plot to graph your manifold. You
# can use either 'o' or '.' as your marker. Graph the first two
# isomap components
#
# .. your code here .. 
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_title('Manifold Scatterplot')
ax.set_xlabel('Component: {0}'.format(0))
ax.set_ylabel('Component: {0}'.format(1))
ax.scatter(T_iso_bear[:,0],T_iso_bear[:,1], marker='.',alpha=0.7, c=color_sample)

开发者ID:ilvitorio,项目名称:EdX---Python-Chapt---4,代码行数:31,代码来源:assignment5.py

示例12: PCA

# 需要导入模块: from sklearn.manifold import Isomap [as 别名]
# 或者: from sklearn.manifold.Isomap import transform [as 别名]
    if basic_plots:
        ax = pp.subplot(2, 1, 1)
        train.describe()[1:].plot(legend=False, ax=ax)
        pp.title("Description of training data.")

        ax = pp.subplot(2, 1, 2)
        train.loc[:,:5].plot(legend=False, ax=ax)
        pp.title("First 5 series plotted.")

        pp.show()

    if do_pca:
        x = train.values
        pca = PCA(n_components=3)
        pca.fit(x)
        y = pca.transform(x)
        print 'Orig shape: ', x.shape, 'New shape: ', y.shape

        pp.scatter(y[:,0], y[:,1], c=target.values)
        pp.show()

    if do_isomap:
        x = train.values
        from sklearn.manifold import Isomap
        isomap = Isomap(n_components=2, n_neighbors=20)
        isomap.fit(x)
        y = isomap.transform(x)

        pp.scatter(y[:,0], y[:,1], c=target.values)
        pp.show()
开发者ID:petermoran,项目名称:kaggle,代码行数:32,代码来源:explore.py

示例13: scoreFromPvalues

# 需要导入模块: from sklearn.manifold import Isomap [as 别名]
# 或者: from sklearn.manifold.Isomap import transform [as 别名]
    print 'offset2: '  , offset2 
    
    #HERE structures must have only atoms of selected chain
    TM_align = rcu.TM_aligned_residues(pdb1,pdb2,offset1, offset2)
    
    
    individualjammings1 = np.asarray(get_permutations(nj1['individual'],TM_align['alignedList1']))
    individualjammings2 = np.asarray(get_permutations(nj2['individual'],TM_align['alignedList2']))
    
    PValsScore = scoreFromPvalues(individualjammings1,individualjammings2)
    print 'PValsScore: ', PValsScore
    
    
    clf = Isomap(n_components=2)#Isomap(n_components=2)
    clf.fit(individualjammings1)
    ij1 = clf.transform(individualjammings1)
    ij2 = clf.transform(individualjammings2)
    print ij1
    f, (ax1, ax2,ax3) = pl.subplots(1,3, sharex=True, sharey=True)
    pl.ioff()
    pl.title('ensemble correlation: %.4f'%PValsScore)
    #pl.subplot(1,2,1)
    ax1.scatter(ij1[:,0],ij1[:,1],marker='o',s=45,facecolor='0.6',edgecolor='r')

    #pl.subplot(1,2,2)
    ax2.scatter(ij2[:,0],ij2[:,1],marker='o',s=45,facecolor='0.6',edgecolor='r')
    ax3.scatter(ij2[:,0],ij2[:,1],marker='o',s=25,facecolor='y',edgecolor='0.05',alpha=0.6)
    ax3.scatter(ij1[:,0],ij1[:,1],marker='o',s=25,facecolor='b',edgecolor='0.05',alpha=0.5)
    ax1.axes.get_xaxis().set_visible(False)
    ax2.axes.get_xaxis().set_visible(False)
    ax3.axes.get_xaxis().set_visible(False)
开发者ID:RicardoCorralC,项目名称:neoj,代码行数:33,代码来源:permutationDistance.py

示例14: preprocess

# 需要导入模块: from sklearn.manifold import Isomap [as 别名]
# 或者: from sklearn.manifold.Isomap import transform [as 别名]
nISOMAP = np.arange(20, 200, 20)

data = {}

for k in nISOMAP:

    features, labels, vectorizer, selector, le, features_data = preprocess("pkl/article_2_people.pkl", "pkl/lable_2_people.pkl")
    features_train, features_test, labels_train, labels_test = cross_validation.train_test_split(features, labels, test_size=0.1, random_state=42)

    t0 = time()
    iso = Isomap(n_neighbors=15, n_components=k, eigen_solver='auto')
    iso.fit(features_train)
    print ("Dimension Reduction time:", round(time()-t0, 3), "s")


    features_train = iso.transform(features_train)
    features_test = iso.transform(features_test)

    for name, clf in [
        ('AdaBoostClassifier', AdaBoostClassifier(algorithm='SAMME.R')),
        ('BernoulliNB', BernoulliNB(alpha=1)),
        ('GaussianNB', GaussianNB()),
        ('DecisionTreeClassifier', DecisionTreeClassifier(min_samples_split=100)),
        ('KNeighborsClassifier', KNeighborsClassifier(n_neighbors=50, algorithm='ball_tree')),
        ('RandomForestClassifier', RandomForestClassifier(min_samples_split=100)),
        ('SVC', SVC(kernel='linear', C=1))
    ]:

        if not data.has_key(name):
            data[name] = []
开发者ID:dikien,项目名称:Machine-Learning-Newspaper,代码行数:32,代码来源:step4_analysis_supervised_4(isomap).py

示例15: PCA

# 需要导入模块: from sklearn.manifold import Isomap [as 别名]
# 或者: from sklearn.manifold.Isomap import transform [as 别名]
# title is your chart title
# x is the principal component you want displayed on the x-axis, Can be 0 or 1
# y is the principal component you want displayed on the y-axis, Can be 1 or 2
#
# .. your code here ..
from sklearn.decomposition import PCA
pca = PCA(n_components=3)
pca.fit(df)
T = pca.transform(df)
Plot2D(T, "PCA 1 2", 1, 2)

#
# TODO: Implement Isomap here. Reduce the dataframe df down
# to THREE components. Once you've done that, call Plot2D using
# the first two components.
#
# .. your code here ..
from sklearn.manifold import Isomap
imap = Isomap(n_neighbors=8, n_components=3)
imap.fit(df)
T2 = imap.transform(df)
Plot2D(T2, "Isomap", 1, 2)
#
# TODO: If you're up for a challenge, draw your dataframes in 3D
# Even if you're not, just do it anyway.
#
# .. your code here ..


plt.show()
开发者ID:anhualin,项目名称:MyLearning,代码行数:32,代码来源:assignment4.py


注:本文中的sklearn.manifold.Isomap.transform方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。