MDS算法实现
2019-02-20 本文已影响4人
一月芷
import numpy as np
import matplotlib.pyplot as plt
from sklearn import datasets,decomposition ,manifold
def load_data():
iris=datasets.load_iris()
return iris.data,iris.target
load_data()
def test_MDS(*data):
mds=manifold.MDS(n_components = 4)
mds.fit(X)
print('stress(n_components=%d):%s'% (4,str(mds.stress_)))
X,y=load_data()
test_MDS(X,y)
MDS算法实现