# source:orange/docs/widgets/rst/unsupervized/mds.rst@11359:8d54e79aa135

Revision 11359:8d54e79aa135, 5.6 KB checked in by Ales Erjavec <ales.erjavec@…>, 12 months ago (diff)

Cleanup of 'Widget catalog' documentation.

:ref:), etc.

Line
1.. _MDS:
2
3MDS
4===
5
6.. image:: ../icons/MDS.png
7
8Multidimensional scaling (MDS) - a projection into a plane fitted to the given
9distances between the points
10
11Signals
12-------
13
14Inputs:
15   - Distance Matrix
16      A matrix of (desired) distances between points
17   - Example Subset (ExampleTable)
18      A subset of examples to be marked in the graph
19
20
21Outputs:
22   - Selected Examples
23      A table of selected examples
24
25
26Signals Example Subset and Selected Examples are only applicable if Distance
27Matrix describes distances between examples, for instance if the matrix comes
28from :ref:`Example Distance`.
29
30Description
31-----------
32
33Multidimensional scaling is a technique which finds a low-dimensional (in our
34case a two-dimensional) projection of points, where it tries to fit the given
35distances between points as well is possible. The perfect fit is typically
36impossible to obtain since the data is higher dimensional or the distances are
37not Euclidean.
38
39To do its work, the widget needs a matrix of distances. The distances can
40correspond to any kinds of object. However, the widget has some functionality
41dedicated to distances between examples, such as coloring the points and
42changing their shapes, marking them, and outputting them upon selection.
43
44The algorithm iteratively moves the points around in a kind of simulation of a
45physical model: if two points are too close to each other (or too far away),
46there is a force pushing them apart (together). The change of the point's
47position at each time interval corresponds to the sum of forces acting on it.
48
49.. image:: images/MDS.png
50
51The first group of buttons set the position of points. :obj:`Randomize` sets
52the to a random position; the initial positions are also random.
53:obj:`Jitter` randomly moves the points for a short distance; this may be
54useful if the optimization is stuck in a (seemingly) local minimum.
55:obj:`Torgerson` positions the points using Torgerson's method.
56
57Optimization is run by pushing :obj:`Optimize`. :obj:`Single Step` makes a
58single step of optimization; this is primarily useful for educative purposes.
59
60Stress function defines how the difference between the desired and the actual
61distance between points translates into the forces acting on them. Several are
62available. Let current and desired be the distance in the current projection
63and the desired distances, and diff=current-desired. Then the stress functions
64are defined as follows:
65
66   - :obj:`Kruskal stress`: diff\ :sup:`2`
67   - :obj:`Sammon stress`: diff\ :sup:`2`\ /current
68   - :obj:`Signed Sammon stress`: diff/current
69   - :obj:`Signed relative stress`: diff/desired
70
71
72The widget redraws the projection during optimization. It can do so at
73:obj:`Every step`, :obj:`Every 10 steps` or :obj:`Every 100 steps`. Setting a
74lower refresh interval makes the animation more visually appealing, but can be
75slow if the number of points is high.
76
77The optimization stops either when the projection changes only minimally at
78the last iteration or when a specified number of steps have been made. The two
79conditions are given with options :obj:`Minimal average stress change` and
80:obj:`Maximal number of steps`.
81
82The bottom of the settings pane shows the average stress (the lower the better)
83and the number of steps made in the last optimization.
84
85.. image:: images/MDS-Graph.png
86   :alt: MDS 'Graph' tab
87   :align: left
88
89The second tab with settings defines how the points are visualized and the
90settings related to outputting the data. The user can set the size of points
91(:obj:`Point Size`) or let the size depend on the value of some continuous
92attribute (:obj:`Size`) of the example the point represents. The color and
93shape of the point (:obj:`Color`, :obj:`Shape`) can depend upon values of
94discrete attributes. Any attribute can serve as a label.
95
96These options are only active if the points represents examples (that is, if
97there is a table of examples attached to the distance matrix on the widget's
98input). If the points represent attributes (e.g. the distance matrix comes
99from :ref:`Attribute Distance`, the points can be labeled by attribute names.
100If the points come from a labeled distance file (see :ref:`Distance File`, the
101labels can be used for annotating the points.
102
103The widget can superimpose a graph onto the projection, where the specified
104proportion of the most similar pairs is connected, with the width of connection
105showing the similarity. This is enabled by checking :obj:`Show similar pairs`
106and setting the proportion of connected pairs below. Enabling this option
107during the optimization can illustrate how the algorithm works, though drawing
108too many connections at each refresh can make the optimization very slow. The
109picture below shows a rendering of the zoo data set with this option enabled.
110
111.. image:: images/MSD-Connected.png
112   :alt: MDS Similar Pairs
113
114The remaining options deal with zooming selecting the points and sending them
115on. The magnifying glass enables zooming, and the other two icons enable
116selection of examples with rectangular or arbitrary selection areas. The
117buttons in the left group undo the last action, remove all selection and send
118the selected examples. Sending the examples can be automatic if
119:obj:`Auto send selected` is checked.
120
121The output data can have the coordinates of each point appended, either as
122normal attributes (:obj:`Append coordinates`) or as meta attributes
123(:obj:`Append coordinates as meta`).
124
125The MDS graph performs many of the functions of the visualizations widget. It
126is in many respects similar to the :ref:`Scatter Plot`, so we recommend