Documentation

# residualSimilarityModel

Residual comparison-based similarity model for estimating remaining useful life

## Description

Use `residualSimilarityModel` to estimate the remaining useful life (RUL) of a component using a residual comparison-based similarity model. This model is useful when you have degradation profiles for an ensemble of similar components, such as multiple machines manufactured to the same specifications, and you know the dynamics of the degradation process. The historical data for each member of the data ensemble is fitted with a model of identical structure. The degradation data of the test component is used to compute 1-step prediction errors, or residuals, for each ensemble model. The magnitudes of these errors indicate how similar the test component is to the corresponding ensemble members.

To configure a `residualSimilarityModel` object, use `fit`, which trains and stores the degradation model for each data ensemble member. Once you configure the parameters of your similarity model, you can then predict the remaining useful life of similar components using `predictRUL`. For similarity models, the RUL of the test component is estimated as the median statistic of the lifetime span of the most similar components minus the current lifetime value of the test component. For a basic example illustrating RUL prediction, see Update RUL Prediction as Data Arrives.

For general information on predicting remaining useful life, see Models for Predicting Remaining Useful Life.

## Creation

### Syntax

``mdl = residualSimilarityModel``
``mdl = residualSimilarityModel(initModel)``
``mdl = residualSimilarityModel(___,Name,Value)``

### Description

example

````mdl = residualSimilarityModel` creates a residual comparison-based similarity model for estimating RUL and initializes the model with default settings.```
````mdl = residualSimilarityModel(initModel)` creates a residual comparison-based similarity model and initializes the model parameters using an existing `residualSimilarityModel` object `initModel`.```

example

````mdl = residualSimilarityModel(___,Name,Value)` specifies user-settable model properties using name-value pairs. For example, `hashSimilarityModel('LifeTimeUnit',"days")` creates a residual comparison-based similarity model that uses days as a lifetime unit. You can specify multiple name-value pairs. Enclose each property name in quotes.```

### Input Arguments

expand all

Residual comparison-based similarity model, specified as a `residualSimilarityModel` object.

## Properties

expand all

Type of model trained using the `fit` function and used for residual generation, specified as one of the following:

• `"linear"` — Line with offset term

• `"poly2"` — Second-order polynomial

• `"poly3"` — Third-order polynomial

• `"exp1"` — Exponential with offset term

• `"exp2"` — Sum of two exponentials

• `"arma2"` — Second-order ARMA model

• `"arma3"` — Third-order ARMA model

• `"arima2"` — Second-order ARMA model with noise integration

• `"arima3"` — Third-order ARMA model with noise integration

Select the model type based on your knowledge of the dynamics of the component degradation process.

You can specify `Method`:

• Using a name-value pair when you create the model

• Using dot notation after model creation

For more information on estimating ARMA and polynomial models, see `armax` and `polyfit`, respectively.

Distance computation method, specified as one of the following:

• `"euclidian"` — Use the 2-norm of the residual signal.

• `"absolute"` — Use the 1-norm of the residual signal.

• Function handle — Use a custom function of the form:

`D = distanceFunction(r)`

where,

• `r` is the residual, specified as a column vector.

• `D` is the distance, returned as nonnegative scalar.

You can specify `Distance`:

• Using a name-value pair when you create the model

• Using dot notation after model creation

Parameters of the fitted models for each member of the training data ensemble, specified as a cell array and assigned by the `fit` function. The content of `Models` depends on the type of model used for regression, as specified in `Method`.

`Method`Model Structure`Models` Cell Content
`"linear"`at + b

Row vector — [a b]

`"poly2"`at2 + bt + c

Row vector — [a b c]

`"poly3"`at3 + bt2 + ct + d

Row vector — [a b c d]

`"exp1"`aebt+c

Row vector — [a b c]

`"exp2"`aebt+cedt

Row vector — [a b c d]

`"arma2"`

Second-order ARMA model:

`$A\left(q\right)S\left(t\right)=C\left(q\right)e\left(t\right)$`

where

• A(q) = [1 a1q-1 a2q-2]

• C(q) = [1 c1q-1]

• S(t) is the degradation feature

Structure with fields:

• `A` — Row vector [1 a1 a2]

• `C` — Row vector [1 c1]

`"arma3"`Similar to `"arma2"`, but with A(q) third-order and C(q) second-order

Structure with fields:

• `A` — Row vector [1 a1 a2 a2]

• `C` — Row vector [1 c1 c2]

`"arima2"`

Similar to `"arma2"`, but with an additional noise integrator:

`$A\left(q\right)S\left(t\right)=\frac{C\left(q\right)}{1-{q}^{-1}}e\left(t\right)$`

Structure with fields:

• `A` — Row vector [1 a1 a2]

• `C` — Row vector [1 c1]

`"arima3"`Similar to `"arma3"`, but with an additional noise integrator

Structure with fields:

• `A` — Row vector [1 a1 a2 a2]

• `C` — Row vector [1 c1 c2]

For more information on estimating ARMA and polynomial models, see `armax` and `polyfit`, respectively.

Mean squared error of the estimation for each model in `Models`, specified as a vector and assigned by the `fit` function.

Ensemble member life spans, specified as a double vector or `duration` object vector and computed from the ensemble member degradation profiles by the `fit` function.

Number of nearest neighbors for RUL estimation, specified as `Inf` or a finite positive integer. If `NumNearestNeighbors` is `Inf`, then `predictRUL` uses all the ensemble members during estimation.

You can specify `NumNearestNeighbors`:

• Using a name-value pair when you create the model

• Using dot notation after model creation

Flag to include ties, specified as `true` or `false`. When `IncludeTies` is `true`, the model includes all neighbors whose distance to the test component data is less than the Kth smallest distance, where K is equal to `NumNearestNeigbors`.

You can specify `IncludeTies`:

• Using a name-value pair when you create the model

• Using dot notation after model creation

Flag for standardizing residuals before computing distance, specified as `true` or `false`.

When `Standardize` is `true`, the residuals are scaled by the inverse square root of the estimated mean squared errors in `ModelMSE`.

You can specify `Standardize`:

• Using a name-value pair when you create the model

• Using dot notation after model creation

Lifetime variable, specified as a string that contains a valid MATLAB® variable name or `""`.

When you train the model using the `fit` function, if your training data is a:

• `table`, then `LifeTimeVariable` must match one of the variable names in the table

• `timetable`, then `LifeTimeVariable` one of the variable names in the table or the dimension name of the time variable, `data.Properties.DimensionNames{1}`

You can specify `LifeTimeVariable`:

• Using a name-value pair when you create the model

• As an argument when you call the `fit` function

• Using dot notation after model creation

Lifetime variable units, specified as a string.

The units of the lifetime variable do not need to be time-based. The life of the test component can be measured in terms of a usage variable, such as distance traveled (miles) or fuel consumed (gallons).

Degradation variable names, specified as a string or string array. The strings in `DataVariables` must be valid MATLAB variable names.

You can specify `DataVariables`:

• Using a name-value pair when you create the model

• As an argument when you call the `fit` function

• Using dot notation after model creation

Flag for using parallel computing for nearest-neighbor searching, specified as either `true` or `false`.

You can specify `UseParallel`:

• Using a name-value pair when you create the model

• Using dot notation after model creation

Additional model information for bookkeeping purposes, specified as any data type or format. The model does not use this information.

You can specify `UserData`:

• Using a name-value pair when you create the model

• Using dot notation after model creation

## Object Functions

 `predictRUL` Estimate remaining useful life for a test component `fit` Estimate parameters of remaining useful life model using historical data `compare` Compare test data to historical data ensemble for similarity models

## Examples

collapse all

`load('residualTrainVectors.mat')`

The training data is a cell array of column vectors. Each column vector is a degradation feature profile for a component.

Create a residual similarity model with default settings.

`mdl = residualSimilarityModel;`

Train the similarity model using the training data.

`fit(mdl,residualTrainVectors)`

`load('residualTrainTables.mat')`

The training data is a cell array of tables. Each table is a degradation feature profile for a component. Each profile consists of life time measurements in the `"Time"` variable and corresponding degradation feature measurements in the `"Condition"` variable.

Create a residual similarity model that fits the data with a third-order ARMA model and uses an absolute distance metric.

`mdl = residualSimilarityModel('Method',"arma3",'Distance',"absolute");`

Train the similarity model using the training data. Specify the names of the life time and data variables.

`fit(mdl,residualTrainTables,"Time","Condition")`

`load('residualTrainTables.mat')`

The training data is a cell array of tables. Each table is a degradation feature profile for a component. Each profile consists of life time measurements in the `"Time"` variable and corresponding degradation feature measurements in the `"Condition"` variable.

Create a residual similarity model that fits the data with a third-order ARMA model and uses hours as the life time unit.

`mdl = residualSimilarityModel('Method',"arma3",'LifeTimeUnit',"hours");`

Train the similarity model using the training data. Specify the names of the life time and data variables.

`fit(mdl,residualTrainTables,"Time","Condition")`

Load testing data. The test data contains the degradation feature measurements for a test component up to the current life time.

`load('residualTestData.mat')`

Predict the RUL of the test component using the trained similarity model.

`estRUL = predictRUL(mdl,residualTestData)`
```estRUL = duration 85.73 hr ```

The estimated RUL for the component is around 86 hours.