Learn episode 01 --- multidimensional scaling dimensionality reduction mds (python × matmab√)

problem

A recent cluster found the time to do a named anonymous-microsoft web.data cube of time, because the data set does not label, encountered some problems in their playing tag in the process. Because the python has been used more to see heavy py, he thought that aspect is very powerful. This is not the question came:
Here Insert Picture Description
call as follows:

from sklearn.manifold import MDS

mds = MDS()
data = mds.fit_transform(这里面放距离矩阵哦)

But it also lacks a vast blue effect ah ...
then read some other people to write in this MDS dimensionality reduction algorithm on the Internet, and this discovery is about the same. Depressed for a while ...

solve

Later found in a paper MATLAB also has such algorithms, and there are examples of successful people, I quickly brought a try, wow Kaka
Here Insert Picture Description
and MATLAB is a specialized processing tools matrix, python to do this with my laptop around 30min He came out, MATLAB only less than 5min. Oh yeah, accompanied by references to the code:

%这是MATLAB里面哦
data = csvread('distance.csv');
data_xy = mdscale(data,2,'criterion','metricsstress');
'''
mdscale()里面的后2个参数保证了同一个地方有两个点不会报错
'''

Now I really still a slag slag.
Also, I feel sklearn of MDS should be otherwise useful, but it's worth I am useless Well, if I have to give lifted with labor wondering why these two different methods, Comments welcome ...

Released six original articles · won praise 0 · Views 69

Guess you like

Origin blog.csdn.net/qq_44851357/article/details/105150774