Sammon and Faq import three-way data: Difference between pages

From Eigenvector Research Documentation Wiki
(Difference between pages)
Jump to navigation Jump to search
imported>Donal
No edit summary
 
imported>Bob
No edit summary
 
Line 1: Line 1:
===Purpose===
===Issue:===


Computes the Sammon projection of multivariate data to lower dimension.
How do I import three-way data into Solo or PLS_Toolbox?


===Synopsis===
===Possible Solutions:===


'''Solution 1) Built in EEM importers :'''


:p = sammon(x, ncolout, ''options'')
If applicable to your file type, use one of the built in EEM importers. There are importers for EEM data from Hitachi, Shimazdu, Horiba and Jasco. Please see this wiki entry for more information on [[Data_Importing_Formats | Data Importing Formats]]
:p = sammon(x, p, ''options'')


===Description===
EEM data needs be configured in a specific way such that:


The Sammon algorithm maps points from a higher dimensional space to a lower dimensional space in such a way as to preserve the relative interpoint distances.
* '''mode 1''' corresponds to '''samples'''


SAMMON is based on algorithm described in:
* <div>'''mode 2''' corresponds to '''emission'''</div>
Sammon, JW (1969): A nonlinear mapping for data structure analysis, IEEE Transactions on Computers 18: 401–409.
Note that in the original paper, the term "y" is used for the projections. In this function, the projections are referred to as "p" to avoid confusion with regression functions.


====Inputs====
* <div>'''mode 3''' corresponds to '''excitation'''</div>
*'''x''' = (matrix or dataset) data to be projected.
*'''ncolout''' = number of output dimensions in the Sammon projection, OR
*'''p''' = the initial projection matrix, with size nrow by ncolout.


====Outputs====
The built-in EEM importers will handle this configuration automatically. When importing manually (see below), further manipulation will likely be necessary. Use the Transform &rarr; Permute modes and Transform &rarr; Reshape smenu items to modify your imported data as appropriate.
* '''p''' = (matrix or dataset) projected coordinates of each data point. Dimension >= 2


===Options===
'''Solution 2) For three-way data with few slabs:'''


options = a structure array with one or more of the following fields:
<ol style="list-style-type:lower-alpha">
  <li>Import the data slabs into the workspace (browser). The workspace browser is available from the main analysis user interface from the menu item FigBrowser.</li>
  <li>Each slab, i.e. each matrix of data is imported individually. Hence, if you have a '''10x8x3''' array, you will import three slabs each of size '''10x8'''.</li>
  <li>Use the mouse to drag slab two onto slab one. In the window that opens choose Augment and then choose augment in the Slabs direction.</li>
  <li>A two-slab three-way array has now replaced the first data matrix. More slabs can be added in the same fashion.</li>
</ol>


* '''niterations''': number of iterations performed.
Alternatively, you may also open one slab in the dataset editor and then add additional slabs using File &rarr; Import. After selecting the next slab to import, answer the same questions as in step c above. Repeat for each slab.  
* '''maxseconds''': Maximum number of seconds allowed. Overrides niterations.
* '''alpha''': [0.2] Sammon's "magic factor"
* '''D''': (matrix) Intersample Euclidean distance, size nrow x nrow.
* '''plots''': [ 'none' | {'final'} ] governs level of plotting.
* '''display''': [ 'on' | {'off'} ] governs level of display to command window.
* '''maxsamples''': [ 2000 ] Maximum number of samples for which Sammon projection will be calculated for. If an array or dataset has more than this number of samples, the Sammon projections will be returned as all NaN's. This is because the algorithm can be quite slow with many samples.


===Example===
'''Solution 3) For larger three-way data:'''


This example code shows the use of SAMMON on the 'arch' dataset, reducing the dimensionality from 10 to 2 while trying to preserving the interpoint spacing. The resulting plot shows the four classes:
In the DataSet editor, you can import a full three-way array if you have it organized as a two-way matrix. Upon importing the two-way data, you can reshape to a three-way array using the menu item: Transform &rarr; Fold into 3-way.  
<pre>
load arch
opts.plots='final';
p = sammon(arch.data,2,opts)
</pre>
The resulting 75x2 array contains the Sammon projection of the 75x10 input array.


If the input data is a dataset with sample classes then the produced plot shows the projected points colored according to their class. Here we see five classes, the four 'arch' classes plus class 0, the unknowns.
For example, you have the above matrices (three slabs) in one table/matrix:
<pre>
load arch
opts.plots='final';
p = sammon(arch,2,opts)
colorbar
</pre>


===See Also===
  [ Slab1;
  Slab2;
  Slab3 ]


[[PCA]]
hence have the three slabs below each other. Upon importing, use the menu option described above to "Fold into 3-way" and choose three as the number of slabs and the data will be rearranged accordingly. If you are familiar with the MATLAB function <code>reshape</code>, you may also use Transform &rarr; Reshape for other types of rearrangements.
 
Note: the result of this command will give you slabs in the 3rd mode of the DataSet. If these slabs are separate samples (such as with EEMs), you'll want to use the Transform &rarr; Permute menu to reorder the dimensions. For example, permuting to the order [3 2 1] would swap the order of the 1st and 3rd modes, putting slabs as the first mode.
 
 
'''Still having problems? Please contact our helpdesk at [mailto:helpdesk@eigenvector.com helpdesk@eigenvector.com]'''
 
[[Category:FAQ]]

Revision as of 10:45, 20 June 2019

Issue:

How do I import three-way data into Solo or PLS_Toolbox?

Possible Solutions:

Solution 1) Built in EEM importers :

If applicable to your file type, use one of the built in EEM importers. There are importers for EEM data from Hitachi, Shimazdu, Horiba and Jasco. Please see this wiki entry for more information on Data Importing Formats

EEM data needs be configured in a specific way such that:

  • mode 1 corresponds to samples
  • mode 2 corresponds to emission
  • mode 3 corresponds to excitation

The built-in EEM importers will handle this configuration automatically. When importing manually (see below), further manipulation will likely be necessary. Use the Transform → Permute modes and Transform → Reshape smenu items to modify your imported data as appropriate.

Solution 2) For three-way data with few slabs:

  1. Import the data slabs into the workspace (browser). The workspace browser is available from the main analysis user interface from the menu item FigBrowser.
  2. Each slab, i.e. each matrix of data is imported individually. Hence, if you have a 10x8x3 array, you will import three slabs each of size 10x8.
  3. Use the mouse to drag slab two onto slab one. In the window that opens choose Augment and then choose augment in the Slabs direction.
  4. A two-slab three-way array has now replaced the first data matrix. More slabs can be added in the same fashion.

Alternatively, you may also open one slab in the dataset editor and then add additional slabs using File → Import. After selecting the next slab to import, answer the same questions as in step c above. Repeat for each slab.

Solution 3) For larger three-way data:

In the DataSet editor, you can import a full three-way array if you have it organized as a two-way matrix. Upon importing the two-way data, you can reshape to a three-way array using the menu item: Transform → Fold into 3-way.

For example, you have the above matrices (three slabs) in one table/matrix:

 [ Slab1;
 Slab2;
 Slab3 ]

hence have the three slabs below each other. Upon importing, use the menu option described above to "Fold into 3-way" and choose three as the number of slabs and the data will be rearranged accordingly. If you are familiar with the MATLAB function reshape, you may also use Transform → Reshape for other types of rearrangements.

Note: the result of this command will give you slabs in the 3rd mode of the DataSet. If these slabs are separate samples (such as with EEMs), you'll want to use the Transform → Permute menu to reorder the dimensions. For example, permuting to the order [3 2 1] would swap the order of the 1st and 3rd modes, putting slabs as the first mode.


Still having problems? Please contact our helpdesk at helpdesk@eigenvector.com