EVRIModel Objects and Evri faq: Difference between pages

From Eigenvector Research Documentation Wiki
(Difference between pages)
Jump to navigation Jump to search
imported>Jeremy
 
imported>Lyle
 
Line 1: Line 1:
==Introduction==
__TOC___
==Importing / Exporting==


EVRIModel Objects provide access to the [[Standard Model Structure]] content of all models and provide some easy-to-use methods and properties for building, manipulating, and reviewing models from Matlab's command line, scripts, and functions. In addition, these properties and methods are available from [[Solo_Predictor_Script_Construction|Solo Scripting]] when using [[Solo_Predictor_User_Guide|Solo_Predictor]] and Solo_Server. This page describes the various modes, methods, and properties of EVRIModel objects, here shortened to just "model objects".
[[faq_concatenate_multiple_files|How do I concatenate multiple files into a single DataSet?]]


Model objects have three distinct states:
[[faq_create_multivariate_image_from_separate_images|How do I create a multivariate image from separate images?]]


# '''Empty Models''' - Empty models can be populated with data to analyze, "meta parameters" (model building settings), and other modeling options, then models can be calibrated or built from those settings.
[[faq_export_PCA_scores_and_loadings_to_text_file|How do I export PCA scores and loadings to a text file (to read into MS Excel, for example)?]]
# '''Calibrated Models''' - Calibrated models contain all the model results and parameters necessary to apply that model to new data. Plots and other information can be obtained from calibrated models.
# '''Applied Models''' - When a calibrated model is applied to new data, the result is a prediction or "applied model". This object contains all the results from applying the model to the new data. Plots and other information can be obtained from applied models.


==Working with Model Objects in Matlab and Solo Scripting==
[[faq_import_three-way_data|How do I import three-way data into Solo or PLS_Toolbox?]]


EVRIModels are standard Matlab objects which are manipulated using the dot notation to access properties and methods. For example, to retrieve the "model type" (modeltype) property from a model, you give the object (a.k.a. variable) name followed by .modeltype. All examples here will assume that the model is stored in a variable named "model".
[[faq_import_horiba_NGC_64bit |Why can't I import a Horiba NGC file on my 64-bit computer?]]


<pre>model.modeltype</pre>
[[faq_SPCREADR_cant_read_multiple_files |Why can't SPCREADR read multiple files I've selected?]]


Most object methods can be accessed in the same way:
[[faq_some_EXCEL_files_fail_to_import |Why do some Excel files fail to import?]]


<pre>model.plotscores</pre>
==General==


Some methods (<tt>.apply</tt> and <tt>.crossvalidate</tt>, for example) also require for additional inputs. These are passed in parenthesis after naming the method:
[[faq_PARALIND_in_PLS_Toolbox |Can I do PARALIND in PLS_Toolbox?]]


<pre>model.apply(newdata)</pre>
[[faq_install_on_more_than_one_PC | Can I install PLS_Toolbox (or Solo) on more than one PC, such as on my desktop and laptop computer?]]


===Displaying Contents===
[[faq_multiple_class_sets_together_in_SIMCA_PLSDA_LDA | Can I use multiple class sets (categorical variables) together in a SIMCA, PLSDA, or LDA model?]]


At the Matlab command line (but not in Solo Scripting), you can view the contents of a model object by simply typing its name or by using the <tt>.disp</tt> method. When viewing content, there are several ways to view the model:
[[faq_more_info_on_R_Squared_statistic | Can you give me more information on the R-Squared statistic?]]
# By Description (Desc.) : this view shows you a text description of the type of model, how it was built, and a summary of its results.
# By Contents : this view contains the raw field information from the model. Users of previous versions of PLS_Toolbox will recognize this as the previous standard display.


At the Matlab command window, you can turn either one of these sections on or off by clicking the [on] or [off] hyperlinks in the top display line (shown in blue below)
[[faq_how_RMSEC_and_RMSECV_related to R2Y_and_Q2Y_seen_other_software | How are RMSEC and RMSECV related to R2Y and Q2Y I see in other software?]]


<tt>  PCA Model Object (Desc. ON/<font color="#0000ee"><u>[off]</u></font>  Contents ON/<font color="#0000ee"><u>[off]</u></font>)</tt>
[[faq_convergence_of_PARAFAC| Convergence of PARAFAC. How much variation between models is expected a particular PARAFAC is fit multiple times with the same settings?]]


[[faq_does_software_stop_working_if_maintenance_expires | Does the software stop working if my maintenance expires?]]


==Building from Uncalibrated Model Objects==
[[faq_report_a_problem_with_PLS_Toolbox | How and where do I report a problem with PLS_Toolbox?]]


When a model object has been initially created, it contains no data and no results. Many model objects' properties can then be populated with data, meta-parameters, and other settings (options) which can then be used with the <tt>.calibrate</tt> method to build a calibrated model. The <tt>.inputs</tt> property lists the specific properties that can be set for a given model type.
[[faq_how_are_T_contributions_calculated | How are T-contributions calculated?]]


:'''NOTE:''' Some model types do NOT support calibration in this manner. In these cases, the <tt>.cancalibrate</tt> property to determine if it allows calibration directly or if it requires a call to the function named in ''modeltype''. In addition, the model will clearly show the state in its display at the command line with a statement to "See _____ function to calibrate." In these cases, the only way to create a calibrated model is to access the named function directly.
[[faq_how_are_ROC_curves_calculated_for_PLSDA | How are the ROC curves calculated for PLSDA?]]


===Example===
[[faq_how_are_error_bars_calculated_regression_model | How are the error bars calculated for a regression model and can they be related to a confidence limit (confidence in the prediction)?]]


The following is an example which would build a PCA model from the data stored in the <tt>data</tt> variable with 3 principal components:
[[faq_improve_performance_with_PLS_Toolbx_and_Matlab_on_Mac | How can I improve performance with PLS_Toolbox and Matlab on the Mac platform?]]


<pre>
[[faq_assign_classes_for_samples_in_a_DataSet | How do I assign classes for samples in a DataSet?]]
model = evrimodel('pca');
model.x = data;
model.ncomp = 3;
model.calibrate;
</pre>


[[faq_build_a_classification_model_from_class_set_other_than_the_first | How do I build a classification model from a class set other than the first?]]


===Uncalibrated Model Properties===
[[faq_choose_between_different_cross_validation_leave_out_options | How do I choose between the different cross-validation leave-out options?]]


The properties of an uncalibrated model depend on the model type. Typically, a value can be provided for the data to model, plus some number of "meta-parameters" which define aspects of how the model will be built. The list of values available is indicated by the .inputs property. All models which are calibratable allow modification of the <tt>.display</tt> and <tt>.plots</tt> properties.
[[faq_reference_Eigenvector| How do I cite/reference Eigenvector?]]


The properties which are generally available for all model types are listed below.
[[faq_interpret_ROC_curves_and_Sensitivity_Specificity_plots_from_PLSDA | How do I interpret the ROC curves and Sensitivity / Specificity plots from PLSDA?]]


[[faq_make_DataSet_backwards_compatible | How do I make a DataSet backwards compatible?]]


====Model Status Properties (Read-Only)====
[[faq_obtain_or_use_recompilation_license_for_PLS_Toolbox | How do I obtain or use a recompilation license for PLS_Toolbox?]]


{| border="1" cellpadding="5" cellspacing="0" align="left" style="margin-left:3em"
[[faq_use_custon_cross_validation_option | How do I use the "custom" cross-validation option?]]
|-
|valign="top" |
<tt>.cancalibrate</tt>
| Returns (1) if the model contains a modeling building definition (see Empty Model description, below), or (0) if the model does not contain a definition and must be calibrated using the function defined in the modeltype property.
|-
|valign="top" |
<tt>.inputs</tt>
| Returns a cell array of strings indicating which properties can be set for the model in its current state. Most often this is used when a model is in an uncalibrated state and this property will indicate what parameters and data fields are available to the user to assign before calibrating the model.
|-
|valign="top" |
<tt>.validmodeltypes</tt>
| Returns a cell array of strings listing the model types which are currently valid for assignment to the <tt>.modeltype</tt> field.
|}


&nbsp;
[[faq_out_of_memory_error_when_analyzing_data | I keep getting "out of memory" errors when analyzing my data. What can I do?]]


====Modifiable Properties====
[[faq_java_lang_OutOfMemoryError| What can I do if I get a java.lang.OutOfMemoryError error?]]
{| border="1" cellpadding="5" cellspacing="0" align="left" style="margin-left:3em"
|-
|valign="top" |
<tt>.modeltype</tt>
| Returns the short "keyword" model type of the current model (or empty string if the model type has not been set). This keyword most often is linked to the PLS_Toolbox function that created the given model. This can be assigned to any model type listed in the <tt>.validmodeltypes</tt> property.
|-
|valign="top" |
<tt>.display</tt>
| String property indicating 'on' if command-line display should be given when calibrating or applying a model and 'off' if no display should be given.
* ''''on'''' : Display command-line output
* ''''off'''' : Do not display any output
|-
|valign="top" |
<tt>.plots</tt>
| String property indicating 'final' if plots should be displayed after calibrating or applying a model and 'none' if no plots should be displayed.
* ''''final'''' : Generate plots (if possible)
* ''''none'''' : Do not generate any plots
|}


&nbsp;
[[faq_why_get_negative_scores_when_all_modes_are_set_to_nonnegativity | Nonnegativity (PARAFAC, PARAFAC2, Tucker): Why do I get negative scores when all modes are set to nonnegativity?]]


===Uncalibrated Model Methods===
[[faq_what_are_relative_contributions | What are "Relative Contributions"?]]


Both of the methods below return a model object. In Matlab, when no output is requested, the model object is stored back into the same object invoked. In Solo Scripting, these methods require an output variable, usually the same model object being built from. For example: <tt>m = m.calibrate</tt>
==Command Line==
==Manual==
==GUI==
==Installation==


{| border="1" cellpadding="5" cellspacing="0" align="left" style="margin-left:3em" |-
|-
|valign="top" |
<tt>.calibrate</tt>
| Build the model based on the current meta-parameters and options.
|-
|valign="top" |
<tt>.crossvalidate(''cvi'',''ncomp'')</tt>
| Build the model and cross-validate with the supplied conditions. ''cvi'' is the cross-validation splitting as described for cvi in [[crossval]] (default = venetian blinds with square-root of the number of samples as splits). ''ncomp'' is the number of components (default = maximum number available).
|}


&nbsp;


==Working With Calibrated Models==


Once calibrated, a model object contains all the results (relevant to the model type) derived from the modeled data. The object also has all the information necessary to apply that model to new data. For many models, methods exist for plotting parts of the model (scores, loadings, eigenvalues, etc.)


===Calibrated Model Properties===


The following properties are available for most models once they have been calibrated.


{| border="1" cellpadding="5" cellspacing="0" align="left" style="margin-left:3em"
[[Category:FAQ]]
|-
|valign="top" |
<tt>.iscalibrated</tt>
| Returns (1) if the model has been calibrated or applied and (0) if the model is in the "empty" state and has not been calibrated.
|-
|valign="top" |
<tt>datasource</tt>
|
|-
|valign="top" |
<tt>date</tt>
|
|-
|valign="top" |
<tt>detail</tt>
|
|-
|valign="top" |
<tt>loadings</tt>
|
|-
|valign="top" |
<tt>ncomp</tt>
|
|-
|valign="top" |
<tt>parent</tt>
|
|-
|valign="top" |
<tt>prediction</tt>
|
|-
|valign="top" |
<tt>q</tt>
|
|-
|valign="top" |
<tt>scores</tt>
|
|-
|valign="top" |
<tt>t2</tt>
|
|-
|valign="top" |
<tt>time</tt>
|
|-
|valign="top" |
<tt>x</tt>
|
|-
|valign="top" |
<tt>x</tt>
|
|-
|valign="top" |
<tt>xhat</tt>
|
|-
|valign="top" |
<tt>y</tt>
|
|-
|valign="top" |
<tt>yhat</tt>
|
|}
 
&nbsp;
 
===Calibrated Model Methods===
 
The following methods are available when a model has been calibrated.
 
 
{| border="1" cellpadding="5" cellspacing="0" align="left" style="margin-left:3em"
|-
|valign="top" |
<tt>.apply()</tt>       
|
|-
|valign="top" |
<tt>.crossvalidate()</tt>       
|
|-
|valign="top" |
<tt>.ploteigen</tt>   
|With no outputs, this method generates a plot of the eigenvalues or other  statistics associated with changing the number of components in the model (e.g. RMSEC, misclassification rates) for the given model. With an output, no plot is generated but the DataSet object containing the data that would have been plotted is returned.
|-
|valign="top" |
<tt>.plotloads</tt>   
|With no outputs, this method generates a plot of the loadings (including all variable-specific statistics and results) for the given model. With an output, no plot is generated but the DataSet object containing the loadings is returned.
|-
|valign="top" |
<tt>.plotscores</tt>   
| With no outputs, this method generates a plot of the scores (including all sample-specific statistics and results) for the given model. With an output, no plot is generated but the DataSet object containing the scores is returned.
|}
 
&nbsp;
 
==Working With Applied Models (Predictions)==
 
When a model is applied to new data, the output is an applied model, also known as a prediction object. The object type itself is still an EVRIModel Object and nearly all of the methods and properties that were available when working with a calibrated model are available with an applied model. The most notable difference is that any plots or sample-specific results extracted from the model will be for the data to which it was applied instead of the calibration data. For example, when a model which calculates scores is applied to new data, the resulting EVRIModel Object will contain a <tt>.scores</tt> property that is the scores calculated for the new data.
 
Whether a model object is a calibrated model or a model prediction can be determined by looking at the <tt>.isprediction</tt> field.
 
===Applied Model Properties===
{| border="1" cellpadding="5" cellspacing="0" align="left"  style="margin-left:3em"
|-
|valign="top" |
<tt>.isprediction</tt>
| Returns (1) if the model contains a prediction from applying a calibrated model to new data and (0) if the model is just "calibrated" or "empty".
|}
 
==General Model Properties and Methods==
 
In addition to the properties and methods described above, the following properties and methods are always available in a model independent of the model state or model type:
 
===Informational Properties (Read-Only)===
{| border="1" cellpadding="5" cellspacing="0" align="left"  style="margin-left:3em"
|-
|valign="top" |
<tt>.author</tt>
| String describing the author and computer on which this model was created. Usually ''user@computername''. Given a system with assigned usernames and computer names, this is equivalent to an electronic signature on a model.
|-
|valign="top" |
<tt>.content</tt>
| Returns the "raw" model information in a form that is most similar to the model structures from previous versions of PLS_Toolbox and Solo. Generally, users need not access this field directly except to provide a model in a form more similar to old models.
|-
|valign="top" |
<tt>.downgradeinfo</tt>
| Informational string explaining the purpose of the <tt>.content</tt> field.
|-
|valign="top" |
<tt>.evrimodelversion</tt><br>
<tt>.modelversion</tt>
| Returns a string containing the model version description. The model version is almost always linked to the version of PLS_Toolbox or Solo that created the given model. The two field names here are synonymous.
|-
|valign="top" |
<tt>.info</tt>
| Returns (or displays with no outputs) the text description of the model. This is the same description shown at the Matlab command line when the model is viewed with content "on". With an output, the results are returned as a cell array of strings.
|-
|valign="top" |
<tt>.uniqueid</tt>
| Returns a string which uniquely identifies this model including the author, author's computer, and a date/time stamp. This uniqueid can be used to safely discriminate between different models.
|-
|valign="top" |
<tt>.validmodeltypes</tt>
| Returns a cell array of strings listing the model types which are currently valid for assignment to the <tt>.modeltype</tt> field.
|}
 
&nbsp;
 
===Model Status Properties (Read-Only)===
{| border="1" cellpadding="5" cellspacing="0" align="left"  style="margin-left:3em"
|-
|valign="top" |
<tt>.isclassification</tt>
| Returns (1) if the model is a classification model that returns class assignments for unknowns or (0) if it is a decomposition or regression model type
|}
 
&nbsp;
===General Methods===
{| border="1" cellpadding="5" cellspacing="0" align="left" style="margin-left:3em"
|-
|valign="top" |
<tt>.disp</tt>
| Displays the contents of the model. There is no output variable from this method, it only displays the information. For access to the content, see the <tt>.info</tt> method.
|-
|valign="top" |
<tt>.help</tt>
| Alone without any additional sub-indexing, this method brings up the help which is most relevant for the particular model type. With the <tt>.predictions</tt> sub-field, this method returns [[Solo_Predictor_Script_Construction#Common_Return_Properties|a structure array of possible sub-fields]] that may be requested for certain properties of the current model.
|}
 
 
&nbsp;

Revision as of 14:15, 29 November 2018

_

Importing / Exporting

How do I concatenate multiple files into a single DataSet?

How do I create a multivariate image from separate images?

How do I export PCA scores and loadings to a text file (to read into MS Excel, for example)?

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

Why can't I import a Horiba NGC file on my 64-bit computer?

Why can't SPCREADR read multiple files I've selected?

Why do some Excel files fail to import?

General

Can I do PARALIND in PLS_Toolbox?

Can I install PLS_Toolbox (or Solo) on more than one PC, such as on my desktop and laptop computer?

Can I use multiple class sets (categorical variables) together in a SIMCA, PLSDA, or LDA model?

Can you give me more information on the R-Squared statistic?

How are RMSEC and RMSECV related to R2Y and Q2Y I see in other software?

Convergence of PARAFAC. How much variation between models is expected a particular PARAFAC is fit multiple times with the same settings?

Does the software stop working if my maintenance expires?

How and where do I report a problem with PLS_Toolbox?

How are T-contributions calculated?

How are the ROC curves calculated for PLSDA?

How are the error bars calculated for a regression model and can they be related to a confidence limit (confidence in the prediction)?

How can I improve performance with PLS_Toolbox and Matlab on the Mac platform?

How do I assign classes for samples in a DataSet?

How do I build a classification model from a class set other than the first?

How do I choose between the different cross-validation leave-out options?

How do I cite/reference Eigenvector?

How do I interpret the ROC curves and Sensitivity / Specificity plots from PLSDA?

How do I make a DataSet backwards compatible?

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

How do I use the "custom" cross-validation option?

I keep getting "out of memory" errors when analyzing my data. What can I do?

What can I do if I get a java.lang.OutOfMemoryError error?

Nonnegativity (PARAFAC, PARAFAC2, Tucker): Why do I get negative scores when all modes are set to nonnegativity?

What are "Relative Contributions"?

Command Line

Manual

GUI

Installation