メインコンテンツ

Training Neural State-Space Models

You can train neural state-space models using either full-batch learning or mini-batch learning. Each learning type has its own advantages and disadvantages. Further, depending on your objective, you can train neural state-space models by performing either a simulation-error minimization (closed-loop training) or an approximate open-loop training. For more information on neural state-space models, see What Are Neural State-Space Models?

This topic describes these approaches to train neural state-space models:

  • Full-Batch Learning

  • Mini-Batch Learning

  • Simulation-Error Minimization (Closed-Loop Training)

  • Approximate Open-Loop Training

Full-Batch Learning

In this approach, in each training epoch, you use all the available data samples for estimation. The software segments the data into M batches, where it decides the value of M based on the values of the WindowSize property, the Overlap property, and the original number of data experiments you choose for training the model. In each training epoch, the software computes an average gradient based on all M batches and then updates the model parameter values.

By default, neural state-space model estimation uses full-batch learning. So to use this approach, you can use the nlssest or nlssinit commands with the default training options.

The advantages of full-batch learning are:

  • Stable Convergence — The parameter updates are based on the entire data set, leading to a smoother and more stable convergence.

  • Efficient Training — The algorithm uses vectorization to accelerate training. Even though each iteration is probably slower, the total training time is often faster.

  • Deterministic Results — Given the same training conditions, full-batch learning will always produce the same model, as there is no randomness in the parameter updates.

Mini-Batch Learning

In stochastic or mini-batch learning, at the start of each training epoch, the algorithm randomly shuffles the order of all the batches. Then the algorithm divides these batches into consecutive groups where each group contains a fraction of the total number of batches as specified by the NumWindowFraction property. During the training epoch, the algorithm iterates over these groups, using a different subset of data samples in each iteration.

For example, if you specify NumWindowFraction as 0.2, in each iteration, the software uses only 20% of the batches to update the network parameters. Consequently, each epoch consists of five (1/0.2) iterations, which means that the software updates the network parameters five times per epoch.

To enable mini-batch learning, specify an Adam, SGDM, or RMSProp training options object using nssTrainingOptions. Then, set the NumWindowFraction property to be less than one. To estimate the neural state-space model, you can use the nlssest or nlssinit commands with the specified training options.

The advantages of mini-batch learning are:

  • Frequent Updates — The algorithm updates the model frequently, potentially leading to a faster convergence.

  • Escaping Local Minima — The inherent noise in the parameter updates can help the model avoid local minima, potentially finding a better overall solution.

  • Memory Efficiency — Stochastic learning is suitable for very large data sets that cannot fit in memory.

Simulation-Error Minimization

Closed-loop training, also known as simulation-error minimization, aims to minimize the simulation error between the measured output and the simulated response of the model, using the first sample of the measured state values as initial condition. To perform closed-loop training of neural state-space models, use nlssest. The nlssest function performs better on noisy data and is well-suited for simulation.

Approximate Open-Loop Training

In approximate open-loop training, you minimize the state-derivative prediction error for continuous-time models and the state-update prediction error for discrete-time models. To perform open-loop training of neural state-space models, use nlssinit. This type of training is usually faster than the simulation-error minimization training. The models trained using nlssinit often serve as a good initial guess for closed-loop training.

For a comprehensive discussion on simulation and prediction, see Simulate and Predict Identified Model Output.

See Also

| | |

Topics