Evrimodel and Manhattandist: Difference between pages

From Eigenvector Research Documentation Wiki
(Difference between pages)
Jump to navigation Jump to search
imported>Scott
 
imported>Benjamin
No edit summary
 
Line 1: Line 1:
===purpose===
===Purpose===
Build an EVRI Model Object.
Calculates Manhattan Distance between Samples (rows) of a Dataset Object (DSO) or a matrix.


===Synopsis===
===Synopsis===


:model = evrimodel(modeltype); %creates a model object of type (modeltype)
:distances = manhattandist(x)
:model = evrimodel; %creates a generic model object
:distances = manhattandist(x,basis)
:distances = manhattandist(x,options)
:distances = manhattandist(x,basis,options)


===Description===
===Description===


An [[EVRIModel_Objects|EVRIModel object]] is a generic object that contains a standard Eigenvector model object. The model can be either "empty" (uncalibrated), "calibrated", or "applied" (prediction on new data). The examples below show building and applying a model using the object's built-in methods.
Calculates the Manhattan Distance, sum of the absolute value differences, from each row to every other row in the supplied matrix or, optionally, all rows of (x) to all rows in a second matrix (basis).


Model objects are also output from numerous PLS_Toolbox functions (in the calibrated or applied state.) The content of these models can be interrogated through the model properties (the object fields available depend on the model type and can be accessed through the "fieldnames" method).
====Inputs====


The models can also be used through the standard methods as described below.
* '''x''' = A DSO or a matrix.


For details on how to work with the objects, the the [[EVRIModel Objects|EVRIModel Objects page]].
====Optional Inputs====


====Optional Input====
* '''basis''' = A second DSO/matrix to compare the first DSO/matrix against when calculating Manhattan distance.
* '''modeltype''' = standard model object type to create. E.g. 'pls','pca'.
* '''options''' = Discussed below.


====Output====
====Outputs====
* '''model''' = standard model object of type (modeltype)


====Examples====
* '''distances''' = A m-by-m matrix containing the comprehensive calculated Manhattan distances between samples.
* '''BUILD MODEL'''
  m = evrimodel('pls'); %creates an empty PLS model object
  m.x = x;              %assigns data to the X-block (predictor)
  m.y = y;              %assigns data to the Y-block (predictand)
  m.ncomp = ncomp;      %sets the number of components in the model
  m.options = options;  %assigns model options with a standard options structure
  m = m.calibrate;          %performs calibration method


* '''CROSS-VALIDATE MODEL'''
====Options====
  m.crossvalidate(x,cvi)


* '''APPLY MODEL'''
options = A structure array with the following fields:
  p = m.apply(data)


* '''PLOT CONTENTS'''
* '''waitbar''': [{'auto'}| 'on' | 'off' ], display waitbar. 'Auto' setting will automatically display a waitbar if computation takes longer than 3 seconds.
  m.plotscores
* '''diag''': {default: 0} Defines the values to be used when comparing a sample to itself. Technically this distance is zero however in some instances, using an alternate value (e.g.: inf) is useful for flagging these self-calculated distances.
  m.plotloads
  m.ploteigen


===Properties===
===See Also===
The following properties can be modified through SETPLSPREF using
  setplspref('evrimodel','property',value)
The properties govern model method behavior and include the following:
====General options====
* '''noobject''': [ {false} | true ] Disables object use altogether.
* '''usecache''': [ {false} | true ] Governs use of model cache when models are calibrated or applied using object methods.
====Type and class testing options====
* '''stricttesting''': [ false | {true} ] Give warning/error when code tests a model by using "isstruct" or "isfield(...,'modeltype'). Best practices are to avoid these methods and use ismodel() instead. This option helps detect code where the poor practices are used.
* '''strictmodeltype''': [ false | {true} ] Give warning/error when a model type is changed to either an undefined model  type or from one model type to an incompatible model type.
* '''fatalalerts''': [ {false} | true ] Governs whether above tests give warnings (false) or throw errors (true).
====Display options====
These settings govern the command-line output for models.
* '''desc''': [ false | {true} ] Governs display of model summary details (same as model.info).
* '''contents''': [ {false} | true ] Governs display of model fields and summary of their contents (old format of display).
====Model application options====
* '''plots''': [ {'none'} | 'final' ] Governs showing of plots when model is calibrated or applied to new data.
* '''display''': [ {'off'} | 'on' ] Governs display of information at the command line when the model is calibrated or applied to new data.
* '''matchvars''': [ 'off' | {'on'} ] Governs use of variable alignment when apply the model to new data (matchvars). For details, see [[EVRIModel Objects]]
* '''contributions''': [ {'passed'} | 'used' | 'full' ] Governs detail of returned T^2 and Q contributions. For details, see [[EVRIModel Objects]]
* '''reducedstats''': [ {'off'} | 'on' ] Governs whether Q and T^2 statistics from models are "reduced" using the confidence limit set in the model.detail.reslim and model.detail.tsqlim fields. For details, see [[EVRIModel Objects]]

Revision as of 13:16, 15 August 2017

Purpose

Calculates Manhattan Distance between Samples (rows) of a Dataset Object (DSO) or a matrix.

Synopsis

distances = manhattandist(x)
distances = manhattandist(x,basis)
distances = manhattandist(x,options)
distances = manhattandist(x,basis,options)

Description

Calculates the Manhattan Distance, sum of the absolute value differences, from each row to every other row in the supplied matrix or, optionally, all rows of (x) to all rows in a second matrix (basis).

Inputs

  • x = A DSO or a matrix.

Optional Inputs

  • basis = A second DSO/matrix to compare the first DSO/matrix against when calculating Manhattan distance.
  • options = Discussed below.

Outputs

  • distances = A m-by-m matrix containing the comprehensive calculated Manhattan distances between samples.

Options

options = A structure array with the following fields:

  • waitbar: [{'auto'}| 'on' | 'off' ], display waitbar. 'Auto' setting will automatically display a waitbar if computation takes longer than 3 seconds.
  • diag: {default: 0} Defines the values to be used when comparing a sample to itself. Technically this distance is zero however in some instances, using an alternate value (e.g.: inf) is useful for flagging these self-calculated distances.

See Also