How to control the layout when using visCompReorder?

Notes:
  • All results are based on supraHex (version 1.13.3).
  • R scripts (i.e. R expressions) plus necessary comments are highlighted in light-cyan background, and the rest are outputs in the screen.
  • Images displayed below may be distorted, but should be normal in your screen.
  • Functions contained in supraHex 1.13.3 are hyperlinked in-place and also listed on the right side.
  • Key texts are underlined, in bold and in pumpkin-orange color.
  •       
    # The layout shown in visCompReorder cannot be controlled by itself. The same thing is true for the side legend, which is automatically changed to fit the overall layout. # Instead, it is controlled by the sister function sCompReorder, from which xdim (and/or ydim) can be specified to layout the dimension of the rectangular lattice. # generate an iid normal random matrix of 100x10 data <- matrix( rnorm(100*10,mean=0,sd=1), nrow=100, ncol=10) colnames(data) <- paste('S', seq(1:10), sep="") # get trained using by default setup sMap <- sPipeline(data=data)
    Start at 2017-03-27 18:59:33 First, define topology of a map grid (2017-03-27 18:59:33)... Second, initialise the codebook matrix (61 X 10) using 'linear' initialisation, given a topology and input data (2017-03-27 18:59:33)... Third, get training at the rough stage (2017-03-27 18:59:33)... 1 out of 7 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 2 out of 7 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 3 out of 7 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 4 out of 7 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 5 out of 7 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 6 out of 7 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 7 out of 7 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) Fourth, get training at the finetune stage (2017-03-27 18:59:33)... 1 out of 25 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 2 out of 25 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 3 out of 25 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 4 out of 25 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 5 out of 25 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 6 out of 25 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 7 out of 25 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 8 out of 25 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 9 out of 25 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 10 out of 25 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 11 out of 25 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 12 out of 25 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 13 out of 25 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 14 out of 25 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 15 out of 25 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 16 out of 25 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 17 out of 25 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 18 out of 25 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 19 out of 25 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 20 out of 25 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 21 out of 25 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 22 out of 25 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 23 out of 25 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 24 out of 25 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) 25 out of 25 (2017-03-27 18:59:33) updated (2017-03-27 18:59:33) Next, identify the best-matching hexagon/rectangle for the input data (2017-03-27 18:59:33)... Finally, append the response data (hits and mqe) into the sMap object (2017-03-27 18:59:33)... Below are the summaries of the training results: dimension of input data: 100x10 xy-dimension of map grid: xdim=9, ydim=9, r=5 grid lattice: hexa grid shape: suprahex dimension of grid coord: 61x2 initialisation method: linear dimension of codebook matrix: 61x10 mean quantization error: 4.9630432442287 Below are the details of trainology: training algorithm: batch alpha type: invert training neighborhood kernel: gaussian trainlength (x input data length): 7 at rough stage; 25 at finetune stage radius (at rough stage): from 3 to 1 radius (at finetune stage): from 1 to 1 End at 2017-03-27 18:59:33 Runtime in total is: 0 secs
    # reorder component planes sReorder <- sCompReorder(sMap=sMap)
    Start at 2017-03-27 18:59:33 First, define topology of a map grid (2017-03-27 18:59:33)... Second, initialise the codebook matrix (30 X 61) using 'linear' initialisation, given a topology and input data (2017-03-27 18:59:33)... Third, get training at the rough stage (2017-03-27 18:59:33)... 1 out of 300 (2017-03-27 18:59:33) 30 out of 300 (2017-03-27 18:59:33) 60 out of 300 (2017-03-27 18:59:33) 90 out of 300 (2017-03-27 18:59:33) 120 out of 300 (2017-03-27 18:59:33) 150 out of 300 (2017-03-27 18:59:33) 180 out of 300 (2017-03-27 18:59:33) 210 out of 300 (2017-03-27 18:59:33) 240 out of 300 (2017-03-27 18:59:33) 270 out of 300 (2017-03-27 18:59:33) 300 out of 300 (2017-03-27 18:59:33) Fourth, get training at the finetune stage (2017-03-27 18:59:33)... 1 out of 1200 (2017-03-27 18:59:33) 120 out of 1200 (2017-03-27 18:59:33) 240 out of 1200 (2017-03-27 18:59:33) 360 out of 1200 (2017-03-27 18:59:33) 480 out of 1200 (2017-03-27 18:59:33) 600 out of 1200 (2017-03-27 18:59:33) 720 out of 1200 (2017-03-27 18:59:33) 840 out of 1200 (2017-03-27 18:59:33) 960 out of 1200 (2017-03-27 18:59:33) 1080 out of 1200 (2017-03-27 18:59:33) 1200 out of 1200 (2017-03-27 18:59:33) Next, identify the best-matching hexagon/rectangle for the input data (2017-03-27 18:59:33)... Finally, append the response data (hits and mqe) into the sMap object (2017-03-27 18:59:33)... Below are the summaries of the training results: dimension of input data: 10x61 xy-dimension of map grid: xdim=6, ydim=5, r=3 grid lattice: rect grid shape: sheet dimension of grid coord: 30x2 initialisation method: linear dimension of codebook matrix: 30x61 mean quantization error: 4.58202954421453 Below are the details of trainology: training algorithm: sequential alpha type: invert training neighborhood kernel: gaussian trainlength (x input data length): 30 at rough stage; 120 at finetune stage radius (at rough stage): from 1 to 1 radius (at finetune stage): from 1 to 1 End at 2017-03-27 18:59:33 Runtime in total is: 0 secs
    # visualise multiple component planes reorded within a sheet-shape rectangle grid visCompReorder(sMap=sMap, sReorder=sReorder) # As you have seen, these 10 samples are organised onto a 6 X 5 rectangle grid. You can change it to 7 X 7, for example: sReorder <- sCompReorder(sMap=sMap, xdim=7, ydim=7)
    Start at 2017-03-27 18:59:34 First, define topology of a map grid (2017-03-27 18:59:34)... Second, initialise the codebook matrix (49 X 61) using 'linear' initialisation, given a topology and input data (2017-03-27 18:59:34)... Third, get training at the rough stage (2017-03-27 18:59:34)... 1 out of 490 (2017-03-27 18:59:34) 49 out of 490 (2017-03-27 18:59:34) 98 out of 490 (2017-03-27 18:59:34) 147 out of 490 (2017-03-27 18:59:34) 196 out of 490 (2017-03-27 18:59:34) 245 out of 490 (2017-03-27 18:59:34) 294 out of 490 (2017-03-27 18:59:34) 343 out of 490 (2017-03-27 18:59:34) 392 out of 490 (2017-03-27 18:59:34) 441 out of 490 (2017-03-27 18:59:34) 490 out of 490 (2017-03-27 18:59:34) Fourth, get training at the finetune stage (2017-03-27 18:59:34)... 1 out of 1960 (2017-03-27 18:59:34) 196 out of 1960 (2017-03-27 18:59:34) 392 out of 1960 (2017-03-27 18:59:34) 588 out of 1960 (2017-03-27 18:59:34) 784 out of 1960 (2017-03-27 18:59:34) 980 out of 1960 (2017-03-27 18:59:34) 1176 out of 1960 (2017-03-27 18:59:34) 1372 out of 1960 (2017-03-27 18:59:34) 1568 out of 1960 (2017-03-27 18:59:34) 1764 out of 1960 (2017-03-27 18:59:35) 1960 out of 1960 (2017-03-27 18:59:35) Next, identify the best-matching hexagon/rectangle for the input data (2017-03-27 18:59:35)... Finally, append the response data (hits and mqe) into the sMap object (2017-03-27 18:59:35)... Below are the summaries of the training results: dimension of input data: 10x61 xy-dimension of map grid: xdim=7, ydim=7, r=4 grid lattice: rect grid shape: sheet dimension of grid coord: 49x2 initialisation method: linear dimension of codebook matrix: 49x61 mean quantization error: 3.08127685132509 Below are the details of trainology: training algorithm: sequential alpha type: invert training neighborhood kernel: gaussian trainlength (x input data length): 49 at rough stage; 196 at finetune stage radius (at rough stage): from 1 to 1 radius (at finetune stage): from 1 to 1 End at 2017-03-27 18:59:35 Runtime in total is: 1 secs
    visCompReorder(sMap=sMap, sReorder=sReorder) # In the function sComReorder, rather than specifying dimensions it is better to change another parameter 'amplifier', which means amplifying the number of samples as a total of nodes in the rectangle grid. The rest work will be done by the function. Internally, once the total nodes are fixed, the xdim/ydim ratio is the square root of the two biggest eigenvalues of the input data.

    Source faq

    FAQ2.r

    Functions used in this FAQ