Main Content

idTreeEnsemble

Decision tree ensemble mapping function for nonlinear ARX models (requires Statistics and Machine Learning Toolbox)

Description

An idTreeEnsemble object implements a decision tree ensemble model, and is a nonlinear mapping function for estimating nonlinear ARX models. This mapping object lets you use RegressionBaggedEnsemble (Statistics and Machine Learning Toolbox), RegressionEnsemble (Statistics and Machine Learning Toolbox), and CompactRegressionEnsemble (Statistics and Machine Learning Toolbox) objects that are created using Statistics and Machine Learning Toolbox™. Unlike most other mapping objects for idnlarx models, which typically contain offset, linear, and nonlinear components, the idTreeEnsemble model contains only a nonlinear component.

Diagram of an idTreeEnsemble object, showing an input, ensemble of trees, and output.

Mathematically, the idTreeEnsemble object maps m inputs x(t) = [x1(t),x2(t),…,xm(t)]T to a scalar output y(t) using a decision tree regression ensemble model.

Here:

  • x(t) is an m-by-1 vector of inputs, or regressors.

  • y(t) is the scalar output.

For more information about creating regression tree ensembles, see fitrensemble (Statistics and Machine Learning Toolbox).

Use idTreeEnsemble as the value of the OutputFcn property of an idnlarx model. For example, specify idTreeEnsemble when you estimate an idnlarx model with the following command.

sys = nlarx(data,regressors,idTreeEnsemble)
When nlarx estimates the model, it essentially estimates the parameters of the idTreeEnsemble object.

You can configure the idTreeEnsemble function to set options and fix parameters. To modify the estimation options, set the option property in E.EstimationOptions, where E is the idTreeEnsemble object. For example, to change the fit method to 'lsboost-resampled', use E.EstimationOptions.FitMethod = 'lsboost-resampled'. To fix the values of an existing estimated idTreeEnsemble during subsequent nlarx estimations, set the Free property to False. Use evaluate to compute the output of the function for a given vector of regressor inputs.

Creation

Description

example

E = idTreeEnsemble creates an empty idTreeEnsemble object E with the default estimation fit method of 'bag'. The number of regressor inputs is determined during model estimation and the number of idTreeEnsemble outputs is 1.

E = idTreeEnsemble(fitmethod) sets the ensemble estimation method to the value in fitmethod.

Input Arguments

expand all

Method to use for estimating the parameters of the idTreeEnsemble model, specified as 'bag', 'lsboost-reweighted', or 'lsboost-resampled'.

This argument sets the property E.EstimationOptions.FitMethod. For more information, see Estimation Options.

Properties

expand all

Regression tree ensemble, specified as a RegressionBaggedEnsemble (Statistics and Machine Learning Toolbox), RegressionEnsemble (Statistics and Machine Learning Toolbox), or CompactRegressionEnsemble (Statistics and Machine Learning Toolbox) object. This property is empty when you first create an idTreeEnsemble object. The estimation process determines the ensemble type based on the values of the FitMethod and Shrink properties, as shown in the following table.

FitMethodShrinkModel Type
'bag'falseRegressionBaggedEnsemble
'lsboost-reweighted'falseRegressionEnsemble
'lsboost-resampled'falseRegressionBaggedEnsemble
'bag' or 'lsboost-reweighted' or 'lsboost-resampled'trueCompactRegressionEnsemble

Option to update the parameters of RegressionEnsembleModel during nonlinear ARX model estimation, specified as true or false. When free is true, the estimation process updates the ensemble model when it estimates the idnlarx model that contains it. When free is false, the ensemble model is fixed during estimation. Setting free to false is useful when you are using a previously estimated ensemble model as a mapping function for nlarx.

Input signal information for signals used for estimation, specified as vectors of m property-specific values, where m is the number of input signals. The Input properties for each input signal are as follows:

  • Name — Names of the input signals, specified as a 1-by-m string or character array, where m is the number of inputs

  • Mean — Mean of the input signals, specified as a numeric scalar

  • Range — Ranges of the input signals, specified as a 2-by-m numeric array that contains the minimum and maximum values

Output signal information, specified as property-specific values. The Output properties are as follows:

  • Name — Name of the output signal, specified as a string or a character array

  • Mean — Mean of the output signal, specified as a numeric scalar

  • Range — Range of the output signal, specified as a 2-by-1 numeric array that contains the minimum and maximum values

Estimation options for the idTreeEnsemble model, specified as follows. For more information on any of these options, see the corresponding name-value argument in fitrensemble (Statistics and Machine Learning Toolbox).

  • FitMethod — Method to use for estimating the parameters of the idTreeEnsemble model, specified as one of the items in the following table.

    Option Description
    'bag'

    Bagging (bootstrap aggregation) (default)

    'lsboost-reweighted'

    Least-squares boosting with reweighting

    'lsboost-resampled'

    Least-squares boosting with resampling

  • NumLearningCycles — Number of ensemble learning cycles, specified as a positive integer. The default value is 100.

  • ResampleData — Option to resample the data, specified as 'on' (default) or 'off'.

    • If FitMethod is set to 'bag', then ResampleData must be set to 'on'.

    • If FitMethod is set to 'lsboost-reweighted', then ResampleData has no effect.

  • ResampleFraction — Fraction of training set to resample, specified as a positive scalar in (0,1].

    • If FitMethod is set to 'lsboost-reweighted', then ResampleFraction has no effect.

  • ReplaceData — Option to sample with replacement, specified as 'off' (default) or 'on'. This property has an effect only if either FitMethod is set to 'bag' or Resample is set to true and FitMethod is set to 'lsboost-resampled' .

  • Regularize — Option to find optimal weights for learners, specified as true (default) or false.

  • Shrink — Option to prune ensemble and return a compact version, specified as true (default) or false.

Examples

collapse all

Load the data mrdamper. This data contains damping force (F) and velocity (V) information for a fluid damper, with a sample time of Ts.

load(fullfile(matlabroot,'toolbox','ident','iddemos','data','mrdamper'))

Create an iddata object data that uses F as the output and V as the input. Divide data into estimation and validation data sets ze and zv.

data = iddata(F,V,Ts);
ze = data(1:3000);
zv = data(3001:end);

Create an empty idTreeEnsemble mapping object E.

E = idTreeEnsemble;

Estimate a nonlinear ARX model sys that uses E for the output function.

sys = nlarx(ze,[16 16 0],E);
Warning: Reached maximum number of iterations. 'Lambda' = 247.7731.

The model stores the estimated mapping object in the property sys.OutputFcn.

sys.OutputFcn
ans = 
Regression Tree Ensemble
Inputs: y1(t-1), y1(t-2), y1(t-3), y1(t-4), y1(t-5), y1(t-6), y1(t-7), y1(t-8), y1(t-9), y1(t-10), y1(t-11), y1(t-12), y1(t-13), y1(t-14), y1(t-15), y1(t-16), u1(t), u1(t-1), u1(t-2), u1(t-3), u1(t-4), u1(t-5), u1(t-6), u1(t-7), u1(t-8), u1(t-9), u1(t-10), u1(t-11), u1(t-12), u1(t-13), u1(t-14), u1(t-15)
Output: y1

 Nonlinear Function: Regression Tree Ensemble

                      Input: 'Function inputs'
                     Output: 'Function output'
    RegressionEnsembleModel: [1×1 classreg.learning.regr.RegressionBaggedEnsemble]
                       Free: 1
          EstimationOptions: 'Estimation option set'

Compare the model simulated output to the estimation data output.

compare(ze,sys)

Compare the model simulated output to the validation data output.

compare(zv,sys)

sys shows a good fit to both the estimation data and the validation data.

See Also

| (Statistics and Machine Learning Toolbox) | (Statistics and Machine Learning Toolbox) | (Statistics and Machine Learning Toolbox) | (Statistics and Machine Learning Toolbox) | | | | | | | | |

Introduced in R2021b