Encodemodelbuilder: Difference between revisions
imported>Jeremy |
imported>Jeremy |
||
Line 11: | Line 11: | ||
Given the input of a standard model structure, this function creates a file which can be used to regenerate a model with the exact options and conditions used to create the model. The resulting function can be used to document how a model was built, or can be used to build new models from new or otherwise modified data. The function is written to take only the inputs required for data blocks for the modeling method (e.g. PCA requires 1, PLS requires 2). For example, if the output file is called "mymodel" and was a PLS model, a new model could be built using: | Given the input of a standard model structure, this function creates a file which can be used to regenerate a model with the exact options and conditions used to create the model. The resulting function can be used to document how a model was built, or can be used to build new models from new or otherwise modified data. The function is written to take only the inputs required for data blocks for the modeling method (e.g. PCA requires 1, PLS requires 2). For example, if the output file is called "mymodel" and was a PLS model, a new model could be built using: | ||
: model = mymodel(x,y) | : <tt>model = mymodel(x,y)</tt> | ||
Remember that the performance of two models built using the same preprocessing and meta-parameter choices but different input data will give different results. Such model building "formulas" should be used with care. Validation of all models is highly recommended. | Remember that the performance of two models built using the same preprocessing and meta-parameter choices but different input data will give different results. Such model building "formulas" should be used with care. Validation of all models is highly recommended. | ||
Line 17: | Line 17: | ||
Note that, with PLSDA models built from X-block classes, the caller must manually create the logical y-block. To do this, use the [[class2logical]] function. For example, to use a modelbuilder-created function on an X block with classes, the following commands would prepare the necessary y-block and build the model: | Note that, with PLSDA models built from X-block classes, the caller must manually create the logical y-block. To do this, use the [[class2logical]] function. For example, to use a modelbuilder-created function on an X block with classes, the following commands would prepare the necessary y-block and build the model: | ||
: y = class2logical(x); | : <tt>y = class2logical(x); | ||
: model = mymodel(x,y); | : model = mymodel(x,y);</tt> | ||
====Inputs==== | ====Inputs==== |
Revision as of 08:34, 31 March 2009
Purpose
Create MATLAB m-code which will regenerate a given model
Synopsis
- encodemodelbuilder(model, filename)
Description
Given the input of a standard model structure, this function creates a file which can be used to regenerate a model with the exact options and conditions used to create the model. The resulting function can be used to document how a model was built, or can be used to build new models from new or otherwise modified data. The function is written to take only the inputs required for data blocks for the modeling method (e.g. PCA requires 1, PLS requires 2). For example, if the output file is called "mymodel" and was a PLS model, a new model could be built using:
- model = mymodel(x,y)
Remember that the performance of two models built using the same preprocessing and meta-parameter choices but different input data will give different results. Such model building "formulas" should be used with care. Validation of all models is highly recommended.
Note that, with PLSDA models built from X-block classes, the caller must manually create the logical y-block. To do this, use the class2logical function. For example, to use a modelbuilder-created function on an X block with classes, the following commands would prepare the necessary y-block and build the model:
- y = class2logical(x);
- model = mymodel(x,y);
Inputs
- model = variable containing a standard PLS_Toolbox model structure.
Optional Inputs
- filename = An optional filename to which the build code should be written. If omitted, the user will be prompted for a filename and folder.