Analyzeparticles and EVRIModel Objects: Difference between pages

From Eigenvector Research Documentation Wiki
(Difference between pages)
Jump to navigation Jump to search
imported>Jeremy
 
imported>Jeremy
 
Line 1: Line 1:
===Purpose===
==Introduction==


ANALYZEPARTCLES Identify particles (blobs, connected regions), and their properties, in an image dataset.
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".


===Synopsis===
Model objects have three distinct states:


: [imgdso, model] = analyzeparticles(x, options);                           
# '''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.
: [imgdso, model] = analyzeparticles(x);                                   
# '''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.
: [imgdso, model] = analyzeparticles(x, model);
# '''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.


===Description===
==Working with Model Objects in Matlab and Solo Scripting==


Particle analysis is used to identify particle-like areas in an image and return information about the identified particles’ characteristics such as their area, shape and pixel values. A particle is considered to be an isolated contiguous region of pixels within the image which have similar intensity values or color values. Particles are also known as “connected regions” or “blobs”.
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".


Our image analysis software can analyze particles in images using either the “analyzeparticles” Matlab function or the “Particle Analysis” GUI, which is a graphical interface to that function. The analyzeparticles function itself is implemented using the ImageJ image analysis package (http://rsb.info.nih.gov/ij/) which is included with our software. Analyzeparticles integrates the ImageJ “Analyze Particles” feature into our software so it can be conveniently used with the Eigenvector dataset object and the other MIA/PLS_Toolbox tools.
<pre>model.modeltype</pre>


====Inputs====
Most object methods can be accessed in the same way:


* '''x''' = image dataset object with one or more slabs,
<pre>model.plotscores</pre>
* '''model''' = previously generated model of type 'ANALYZEPARTICLES' (when applying model to new data).


====Outputs====
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:
* '''imgdso''' = input imgdso modified with addition of classesets identifying particles. One classset has a class for each particle. Pixels within particle j have class = j. Non particle pixels have class = 0. Second classset has one class for all particles. Pixels within any particle have class = 1. Non particle pixels have class = 0.
* '''model''' = a standard model structure model with the following fields (see [[Standard Model Structure]]):
** '''modeltype''': 'ANALYZEPARTICLES',
** '''datasource''': structure array with information about input data,
** '''date''': date of creation,
** '''time''': time of creation,
** '''info''': additional model information,
** '''particletable''': A dataset containing the requested particle properties,
***  Rows are particles,
***  Columns represent properties, identified by particletable.label{2}.
** '''allparticles''': a vector with one entry per pixel, value = 0 if pixel is not a particle pixel, 1 otherwise.
** '''particles''': a vector with one entry per pixel, value = j, where j = 0, 1, ...n if pixel is part of particle number j.
** '''foreground''': a vector with one entry per pixel, value = 0 or 255, showing the binary image representing all possible particle pixels.
** '''detail''': sub-structure with additional model details and results, including:
*** model.detail.thresholdValue: the threshold value used in forming the binary image,
*** model.detail.height: height of the image (in pixels),
*** model.detail.width: width of the image (in pixels),
*** model.detail.nparticles: number of identified particles,
*** model.detail.ij: contains the Java evri.ij.plugin.ParticlesAnalyzer object.


===Options===
<pre>model.apply(newdata)</pre>
''options'' =  a structure array with the following fields:


* '''display''': [ 'off' | {'on'} ], governs level of display to command window. 'off' suppresses output,
===Displaying Contents===
* '''plots''' [ 'none' | {'final'} ], governs level of plotting,


* '''includeholes''': [ 'off' | {'on'} ], holes within particles are included?,
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:
* '''includeedgeparticles''': [ {'off'} | 'on' ], include particles intersecting the image's edge?,
# 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.
* '''thresholdslab''': Index of dataset slab to use for creating binary image. Default = [],
# 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.
* '''thresholdvalue''': Value to use as threshold when creating binary image,
* '''reversemask''': [ 'off' | {'on'}] reverse the particle binary mask?
* '''apply_abs''': [ {'off'} | 'on' ] apply absolute value to data initially?
The following four options represent criteria which potential particles must satisfy to be considered particles:
* '''minsize''': Lower limit to particle area. Default is 50 pixels,
* '''maxsize''': Upper limit to particle area. Default is infinite,
* '''mincircularity''': Lower limit to particle circularity. Default = 0.0,
* '''maxcircularity''': Upper limit to particle circularity. Default = 1.0,
The remaining options indicate whether these additional particle properties should be measured and reported:
* '''particleminmax''': [ {'off'} | 'on' ] measure particle min and max values,
* '''particlemedian''': [ {'off'} | 'on' ] measure particle median value,
* '''particlestddev''': [ {'off'} | 'on' ] measure particle standard deviation value,
* '''particleperimeter''': [ {'off'} | 'on' ] measure length of particle perimeter (pixels),
* '''particleshape''': [ {'off'} | 'on' ] measure particle shape parameters (Conc., AR, Round, Solidity),
* '''particleferet''': [ {'off'} | 'on' ] measure Feret diameters of particle.


===Algorithm===
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)
There are two steps to particle analysis of an image dataset object (DSO). The first step is to obtain a binary image where image pixel values are either 0 or 1 where one value represents non-particle pixels and the other represents potential particle pixels.  This is usually accomplished by specifying a threshold level where pixels having a value below or above the threshold value are assigned value 0 or 1. If no threshold level is specified then one is automatically determined as in the ImageJ auto thresholding method. If the image DSO has multiple slabs then one slab must be selected to determine the binary image or else the average of all the slabs can be used. A pixel assigned value 1 is not automatically part of a particle because other particle criteria can be specified such as a minimum particle area requirement, or other shape restriction. Once these filters are applied there may remain some particle regions.


The second step in particle analysis is to calculate the properties of each particle region. Properties include area, perimeter, centroid coordinates, shape properties (circularity, aspect ratio, roundness, and solidity) and Feret’s diameters (Feret diameter, FeretX, FeretY, FeretAngle and MinFeret). There are other particle properties which depend on the particle’s pixel values including mean, median, minimum, maximum, and standard deviation. These are calculated for each slab for each particle.
<tt>  PCA Model Object (Desc. ON/<font color="#0000ee"><u>[off]</u></font> Contents ON/<font color="#0000ee"><u>[off]</u></font>)</tt>




====Measured Particle Properties====
==Building from Uncalibrated Model Objects==
Properties of each particle are returned in the model.particletable DSO. Particles' centroid coordinates (w, h) are always returned. Coordinates are given using the image convention where (x,y) indicates distance in pixels measured from the top left corner of the image, so the top left corner has coordinates (0,0) while the bottom right corner has coordinates (nwidth-1, nheight-1).
*'''X, Y''' are the coordinates of the particle's centroid.


Additional particle properties can be obtained by specifying options:
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.
*'''Mean''' = mean pixel value over particle, per slab
*'''Median''' = mean pixel value over particle, per slab
*'''Min''' = minimum pixel value over particle, per slab
*'''Max''' = maximum pixel value over particle, per slab
*'''StdDev''' = standard deviation of pixel values over particle, per slab.


Particle properties which only depend on the particle shape (are the same for all slabs) include:
:'''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.
*'''Area''' = area of particle (in square pixels),
*'''Perim.''' = length of particle perimeter in pixel lengths.


Particle shape properties:
===Example===
*'''Circ.''' (circularity = 4π*area/perimeter^2.  A value of 1.0 indicates a perfect circle. As the value approaches 0.0, it indicates an increasingly elongated shape. Values may not be valid for very small particles. Also note that a circular particle with large holes will have smaller area than a circle with that perimeter, so circularity is only accurate if the particle has no holes (or 'includeholes=on'). A circular particle with large holes will have small solidity.


*'''AR''' (aspect ratio)  = major_axis/minor_axis.
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:


*'''Round''' (roundness) = 4*area/(π*major_axis^2), or the inverse of the aspect ratio.
<pre>
model = evrimodel('pca');
model.x = data;
model.ncomp = 3;
model.calibrate;
</pre>


*'''Solidity'''          = area/convex area.


Particle Feret diameters,
===Uncalibrated Model Properties===
Feret's Diameter is the longest distance between any two points along the particle boundary, also known as maximum caliper. The angle (0-180 degrees) of the Feret's diameter is displayed as FeretAngle, as well as the minimum caliper diameter (MinFeret).


*'''Feret'''        = Feret's diameter of particle (length in pixels)
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.


*'''FeretX'''      = Coordinate of one end of Feret's diameter.
The properties which are generally available for all model types are listed below.


*'''FeretY'''      = Coordinate of one end of Feret's diameter.


*'''FeretAngle'''  = Angle between Feret's diameter and x-axis.
====Model Status Properties (Read-Only)====


*'''MinFeret'''    = Minimum Feret's diameter of particle (length in pixels)
{| border="1" cellpadding="5" cellspacing="0" align="left" style="margin-left:3em"
|-
|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.
|}


====Filtering Particles by Size and Circularity====
&nbsp;
The number of particles returned by analyzeparticles can be reduced by specifying a minimum or maximum area or circularity that a particle must have. These values can be specified as options.minsize, options.maxsize, options.mincircularity, options.maxcircularity, or default values will be used.


====Reverse Mask to Measure Bright Particles====
====Modifiable Properties====
The default behavior is to identify particles as connected regions which have intensity above a threshold value. This identifies brighter areas as particles while the rest of the image is considered a darker background. In some images, however, the particles may appear as darker spots on a brighter background. Such particles can be analyzed by setting the input option "reversemask" to "off" instead of its default value "on".
{| 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
|}


====Handling of Holes Within Particles====
&nbsp;
The default behavior of analyzeparticles is to measure a particle's area or mean pixel value, etc. by including all enclosed pixels. Thus any holes within an enclosing particle do contribute to the particle's area or mean pixel value. This behavior can be changed by specifying the input option.includeholes = 'off', which will mean that non-particle pixels within the surrounding particle boundary are not used in calculating the particle area or mean pixel value, etc.. Any "child" particles within such a hole are reported as additional particles and do not contribute to the enclosing particle's area and mean, etc..


====Handling of Excluded Pixels====
===Uncalibrated Model Methods===
Pixels which are flagged as excluded by the dataset object are treated as non-particle pixels.


===See Also===
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>


[[analysis]], [[particlegui]]
{| 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" style="margin-left:3em"
|-
|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" 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".
|}
 
&nbsp;
 
==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 05:12, 10 September 2012

Introduction

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 Scripting when using Solo_Predictor and Solo_Server. This page describes the various modes, methods, and properties of EVRIModel objects, here shortened to just "model objects".

Model objects have three distinct states:

  1. 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.
  2. 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.
  3. 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

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".

model.modeltype

Most object methods can be accessed in the same way:

model.plotscores

Some methods (.apply and .crossvalidate, for example) also require for additional inputs. These are passed in parenthesis after naming the method:

model.apply(newdata)

Displaying Contents

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 .disp method. When viewing content, there are several ways to view the model:

  1. 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.
  2. 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)

PCA Model Object (Desc. ON/[off] Contents ON/[off])


Building from Uncalibrated Model Objects

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 .calibrate method to build a calibrated model. The .inputs property lists the specific properties that can be set for a given model type.

NOTE: Some model types do NOT support calibration in this manner. In these cases, the .cancalibrate 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.

Example

The following is an example which would build a PCA model from the data stored in the data variable with 3 principal components:

model = evrimodel('pca');
model.x = data;
model.ncomp = 3;
model.calibrate;


Uncalibrated Model Properties

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 .display and .plots properties.

The properties which are generally available for all model types are listed below.


Model Status Properties (Read-Only)

.cancalibrate

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.

.inputs

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.

.validmodeltypes

Returns a cell array of strings listing the model types which are currently valid for assignment to the .modeltype field.

 

Modifiable Properties

.modeltype

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 .validmodeltypes property.

.display

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

.plots

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

 

Uncalibrated Model Methods

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: m = m.calibrate

.calibrate

Build the model based on the current meta-parameters and options.

.crossvalidate(cvi,ncomp)

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).

 

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.

.iscalibrated

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.

datasource

date

detail

loadings

ncomp

parent

prediction

q

scores

t2

time

x

x

xhat

y

yhat

 

Calibrated Model Methods

The following methods are available when a model has been calibrated.


.apply()

.crossvalidate()

.ploteigen

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.

.plotloads

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.

.plotscores

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.

 

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 .scores 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 .isprediction field.

Applied Model Properties

.isprediction

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)

.author

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.

.content

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.

.downgradeinfo

Informational string explaining the purpose of the .content field.

.evrimodelversion
.modelversion

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.

.info

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.

.uniqueid

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.

.validmodeltypes

Returns a cell array of strings listing the model types which are currently valid for assignment to the .modeltype field.

 

Model Status Properties (Read-Only)

.isclassification

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

 

General Methods

.disp

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 .info method.

.help

Alone without any additional sub-indexing, this method brings up the help which is most relevant for the particular model type. With the .predictions sub-field, this method returns a structure array of possible sub-fields that may be requested for certain properties of the current model.