nowmds tries to position the individual data points in the lower dimensional space such that the new distance there resembles as much as possible the distances in the original space as mds is often used for visualizationthe choice of the lower dimension is most of the time two or three let us have look at the following simple data consisting of three data points in five-dimensional space two of the data points are close by and one is very distinctand we want to visualize that in three and two dimensions as followsx np c_[np ones( ) np ones( ) np ones( ) print( [ ]using the class mds in scikit-learn' manifold packagewe first specify that we want to transform into three-dimensional space as followsfrom sklearn import manifold mds manifold mds(n_components= xtrans mds fit_transform(xto visualize it in two dimensionswe would have to say so using n_components the results can be seen in the following two graphs the triangle and circle are both close togetherwhereas the star is far away