Mpca and Faq obtain or use recompilation license for PLS Toolbox: Difference between pages

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


Multi-way (unfold) principal components analysis.
How do I obtain or use a recompilation license for PLS_Toolbox?


===Synopsis===
===Possible Solutions:===
:mpca - Launches an analysis window with MPCA as the selected method. 
:model = mpca(mwa,ncomp,''options'')
:model = mpca(mwa,ncomp,preprostring)
:pred = mpca(mwa,model,''options'')


===Description===
The standard [http://www.eigenvector.com/software/license_evri.html PLS_Toolbox license] does not permit recompilation of any part of the code without written permission from Eigenvector Research, Inc. This permission is usually in the form of a recompiliation license (for more information on recompilation licenses, see: our [http://www.eigenvector.com/evriblog/?p=27 Blog post on Compiling PLS_Toolbox] ).


Principal Components Analysis of multi-way data using unfolding to a 2-way matrix followed by conventional PCA.
If you have purchased a recompiliation license for PLS_Toolbox and/or other Matlab-based Eigenvector Research products, you can use the following instructions to compile your application including the licensed Eigenvector Research (EVRI) code.


Inputs to MPCA are the multi-way array mwa (class "double" or "dataset") and the number of components to use in the model nocomp. To make predictions with new data the inputs are the multi-way array mwa and the MPCA model model. Optional input ''options'' is discussed below.
# If you were not supplied an ''evrilicense.lic'' file by EVRI, create one by copying the license code supplied for your compilation license (found on the download tab of your EVRI account) into a plain-text file named: ''evrilicense.lic'' The file should consist of the license code on a single line of the file. For example: <pre>12345678-98765432-ab-1234-1234</pre>
# Copy the ''evrilicense.lic'' file into one of the folders on your Matlab path. This could be either one of the PLS_Toolbox folders, or your application's folder.
# Add the ''evrilicense.lic'' file to the "Shared Resources" list in the Matlab project builder. This will assure that the EVRI license gets included in the compiled application.
# Compile your application as usual using Mathworks' standard instructions. The Matlab dependency logic will automatically include the PLS_Toolbox functions in your compiled application. (See note below regarding "blocking" certain functions from being included.)


For assistance in preparing batch data for use in MPCA please see [[bspcgui]].
'''Blocking Unnecessary Functions'''


The output model is a structure array with the following fields:
By default, Matlab's compiler automatically identifies all m-files which are necessary to run your application and includes all of these in the compiler output. Because of the integrated nature of many of the PLS_Toolbox functions, this can lead to "sprawl" - inclusion of many more functions than are actually needed. The follow steps can be taken to reduce the size of a compiled application:


* '''modeltype''': 'MPCA',
* Remove PLS_Toolbox 'dems' folder and 'help' folder from your path prior to compiling. Files in these folders can be large and are unnecessary for compilation.


* '''datasource''': structure array with information about the x-block,
* Add "dummy" functions to reduce dependencies:
:: One way to help reduce these unnecessary additions is to create empty "shell" functions to overload certain PLS_Toolbox functions. These functions, if placed in a folder above PLS_Toolbox when you are compiling, will shadow (hide) the actual function and help avoid sprawl. In particular the following functions are useful to shadow:


* '''date''': date of creation,
:* analysis.m
:* browse.m
:* plotgui.m
:* browse.m
:* evriinstall.m
:* evrireporterror.m


* '''time''': time of creation,
:: These functions will not be called in normal operation and, in most cases, our compilation licenses do not permit their inclusion in your application anyway.


* '''info''': additional model information,
* Find top level functions and see if you can "manually" determine dependencies. Look at the results of the top level dependency check and see what functions are called from the primary PLS_Toolbox function you're working with. If the dependencies are few, you may be able to iterate over the results (get 'toponly' dependencies from results) and get a smaller subset of dependencies. '''NOTE''': This will require some experimentation and time to work through. The dataset object is extensively used by most function so this folder should almost always be included.


* '''loads''': 1 by 2 cell array with model loadings for each mode/dimension,
<pre> [fList, pList] = matlab.codetools.requiredFilesAndProducts('peakfind','toponly') </pre>


* '''pred''': cell array with model predictions for each input data block (this is empty if options.blockdetail = 'normal'),
'''Uninstall the Stats Toolbox '''


* '''tsqs''': cell array with T<sup>2</sup> values for each mode,
Although moving the Stats Toolbox below PLS_Toolbox on your MATLAB path (or removing the Stats Toolbox folders altogether) will allow the PLS_Toolbox DataSet Object to function normally, you must uninstall the Stats Toolbox before compiling PLS_Toolbox function that require the DataSet Object.


* '''ssqresiduals''': cell array with sum of squares residuals for each mode,
The MathWorks states:  


* '''description''': cell array with text description of model, and
"When you compile [a program] into an application and run it, the MATLAB Compiler Run-time references its in-built Dataset function which is higher in its PATH and hence runs the data against this inbuilt Dataset function."


* '''detail''': sub-structure with additional model details and results.
For more information on the DataSet Object history see here:
*[http://www.eigenvector.com/evriblog/?p=10 DataSet Object Conflict]
*[http://www.eigenvector.com/evriblog/?p=11 DataSet Object — Letter to MathWorks March 15, 2007]


===Options===
'''Troubleshooting'''


'''options''' = a structure array with the following fields.
* In some cases PLS_Toolbox may need to be moved out of the default installation folder into a folder with more permissions and/or no spaces in the path. For example, "C:\eigenvector\PLS_Toolbox".
'''Still having problems? Please contact our helpdesk at [mailto:helpdesk@eigenvector.com helpdesk@eigenvector.com]'''


* '''display''': [ 'off' | {'on'} ]  governs level of display to command window,
[[Category:FAQ]]
 
* '''plots''': [ 'none' | {'final'} ]  governs level of plotting,
 
* '''outputversion''': [ 2 | {3} ]  governs output format,
 
* '''preprocessing''': { [] }  preprocessing structure, {default is mean centering i.e. options.preprocessing = preprocess('default', 'mean center')} (see PREPROCESS),
 
* '''algorithm''': [ {'svd'} | 'maf' | 'robustpca' ], algorithm for decomposition, Algorithm 'maf' requires Eigenvector's MIA_Toolbox.
 
* '''confidencelimit''': [ {'0.95'} ], confidence level for Q and T2 limits. A value of zero (0) disables calculation of confidencelimits.
 
* '''roptions''': structure of options to pass to robpca (robust PCA engine from the Libra Toolbox).
 
* '''blockdetails''': [ 'compact' | {'standard'} | 'all' ]  extent of detail in predictions and residuals included in model structure ('standard' results in sum of squared residuals, and 'all' gives all x-block residuals), and
 
* '''samplemode''': [ {3} ]  mode (dimension) to use as the sample mode e.g. if it is 3 then it is assumed that mode 3 is the sample/object dimension i.e. if mwa is 7x9x10 then the scores model.loads{1} will have 10 rows (it will be 10xncomp).
 
The default options can be retreived using: options = mpca('options');.
 
It is also possible to input just the preprocessing option as an ordinary string in place of ''options'' and have the remainder of options filled in with the defaults from above. The following strings are valid:
 
: ''''none'''': no scaling,
 
: ''''auto'''': unfolds array then applies autoscaling,
 
: ''''mncn'''': unfolds array then applies mean centering, or
 
: ''''grps'''': {default} unfolds array then group/block scales each variable, i.e. the same variance scaling is used for each variable along its time trajectory (see GSCALE).
 
MPCA will work with arrays of order 3 and higher. For higher order arrays, the last order is assumed to be the sample order, ''i.e.'' for an array of order ''n'' with the dimension of order ''n'' being ''m'', the unfolded matrix will have ''m'' samples. For arrays of higher order the group scaling option will group together all data with the same order 2 index, for multiway array mwa, each mwa(:,j,:, ... ,:) will be scaled as a group.
 
===See Also===
 
[[analysis]], [[bspcgui]], [[evolvfa]], [[ewfa]], [[explode]], [[parafac]], [[pca]], [[preprocess]]

Revision as of 11:28, 28 June 2019

Issue:

How do I obtain or use a recompilation license for PLS_Toolbox?

Possible Solutions:

The standard PLS_Toolbox license does not permit recompilation of any part of the code without written permission from Eigenvector Research, Inc. This permission is usually in the form of a recompiliation license (for more information on recompilation licenses, see: our Blog post on Compiling PLS_Toolbox ).

If you have purchased a recompiliation license for PLS_Toolbox and/or other Matlab-based Eigenvector Research products, you can use the following instructions to compile your application including the licensed Eigenvector Research (EVRI) code.

  1. If you were not supplied an evrilicense.lic file by EVRI, create one by copying the license code supplied for your compilation license (found on the download tab of your EVRI account) into a plain-text file named: evrilicense.lic The file should consist of the license code on a single line of the file. For example:
    12345678-98765432-ab-1234-1234
  2. Copy the evrilicense.lic file into one of the folders on your Matlab path. This could be either one of the PLS_Toolbox folders, or your application's folder.
  3. Add the evrilicense.lic file to the "Shared Resources" list in the Matlab project builder. This will assure that the EVRI license gets included in the compiled application.
  4. Compile your application as usual using Mathworks' standard instructions. The Matlab dependency logic will automatically include the PLS_Toolbox functions in your compiled application. (See note below regarding "blocking" certain functions from being included.)

Blocking Unnecessary Functions

By default, Matlab's compiler automatically identifies all m-files which are necessary to run your application and includes all of these in the compiler output. Because of the integrated nature of many of the PLS_Toolbox functions, this can lead to "sprawl" - inclusion of many more functions than are actually needed. The follow steps can be taken to reduce the size of a compiled application:

  • Remove PLS_Toolbox 'dems' folder and 'help' folder from your path prior to compiling. Files in these folders can be large and are unnecessary for compilation.
  • Add "dummy" functions to reduce dependencies:
One way to help reduce these unnecessary additions is to create empty "shell" functions to overload certain PLS_Toolbox functions. These functions, if placed in a folder above PLS_Toolbox when you are compiling, will shadow (hide) the actual function and help avoid sprawl. In particular the following functions are useful to shadow:
  • analysis.m
  • browse.m
  • plotgui.m
  • browse.m
  • evriinstall.m
  • evrireporterror.m
These functions will not be called in normal operation and, in most cases, our compilation licenses do not permit their inclusion in your application anyway.
  • Find top level functions and see if you can "manually" determine dependencies. Look at the results of the top level dependency check and see what functions are called from the primary PLS_Toolbox function you're working with. If the dependencies are few, you may be able to iterate over the results (get 'toponly' dependencies from results) and get a smaller subset of dependencies. NOTE: This will require some experimentation and time to work through. The dataset object is extensively used by most function so this folder should almost always be included.
 [fList, pList] = matlab.codetools.requiredFilesAndProducts('peakfind','toponly') 

Uninstall the Stats Toolbox

Although moving the Stats Toolbox below PLS_Toolbox on your MATLAB path (or removing the Stats Toolbox folders altogether) will allow the PLS_Toolbox DataSet Object to function normally, you must uninstall the Stats Toolbox before compiling PLS_Toolbox function that require the DataSet Object.

The MathWorks states:

"When you compile [a program] into an application and run it, the MATLAB Compiler Run-time references its in-built Dataset function which is higher in its PATH and hence runs the data against this inbuilt Dataset function."

For more information on the DataSet Object history see here:

Troubleshooting

  • In some cases PLS_Toolbox may need to be moved out of the default installation folder into a folder with more permissions and/or no spaces in the path. For example, "C:\eigenvector\PLS_Toolbox".

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