Wolfram ResearchPRODUCTSPURCHASEFOR USERSCOMPANYOUR SITES

 Documentation /  Neural Networks /  Dynamic Neural Networks /  Examples /

Identifying the Dynamics of a DC-MotorBias-Variance Trade-Off: Avoiding Overfitting

8.2.3 Identifying the Dynamics of a Hydraulic Actuator

In this example the dynamics of a hydraulic actuator will be modeled. The data used was kindly provided by P. Krus at the Fluid Power Technology group of the Department of Mechanical Engineering, Linkoping University, http://hydra.ikp.liu.se.

The input signal is the opening of a valve, which influences the flow of oil into a cylinder acting on a robot arm. The oil pressure is the output signal that relates to the position of the robot arm. The goal is to find a mathematical model describing how the valve opening influences the oil pressure.

Load the Neural Network package and the data.

In[1]:=

In[2]:=

The input data is placed in u and the output data in y.

Check the dimensions.

In[3]:=

Out[3]=

Out[4]=

The 1024 input and output data samples involved are plotted.

Plot the input signal.

In[5]:=

Plot the output signal.

In[6]:=

As in the previous example, the first half of the data set is used for identification and the second half for validation of the model.

Divide the data set into estimation and validation data.

In[7]:=

The first candidate model is a linear model so that you have something to compare the nonlinear model to. The chosen regressor indices are =3, =2, and =1, which give a regressor x(t)={y(t-1), y(t-2), y(t-3), u(t-1), u(t-2)}. The linear model then becomes

y(t)=

where Theta is a parameter vector of length 5 and is a level parameter.

A linear model is obtained by using a FeedForwardNet without any hidden layer. Since the parameter estimate of linear models can be computed exactly with only one training iteration, no iterative training is necessary.

Estimate a linear model of the hydraulic actuator.

In[11]:=

Provide information about the model.

In[12]:=

Out[12]=

Use NetComparePlot to produce a prediction and compare the result to the true output. Since the first half of the data was used for training, the second half is used for a fair validation.

A short prediction horizon will often yield good prediction performance if the signals are dominated by low frequencies. Therefore, it might be hard to evaluate the model's quality from a one-step prediction, which is shown here.

Compare a one-step prediction with the true output.

In[13]:=

The one-step prediction looks good, and it is hard to see the difference between the predicted and the true output. Often it is more interesting to look at the result using a larger prediction horizon or a pure simulation.

Compare a simulation with the true output.

In[14]:=

After having obtained a linear model, you can try to derive a better nonlinear one. This can be done by using the same regressor as earlier, but adding a hidden layer to the network.

Train an FF network with four neurons on the hydraulic actuator.

In[15]:=

Depending on the initialization the training ends up in different local minima. If the result is not satisfactory you can repeat the training, and a new initialization is used each time.

Simulate the nonlinear model and compare the result with the true output.

In[16]:=

Evaluate the model on validation data using a one-step prediction.

In[17]:=

Is the performance better than the linear model?

It might be interesting to look at the prediction errors to see where on the data sequence the model performs well.

Compute and plot the prediction errors.

In[18]:=

You can also look at the distribution of the prediction errors. Such a plot can indicate if the model has problems explaining some individual data samples.

Display the distribution of the prediction errors with a histogram.

In[20]:=

You can plot the linearization at each sampling instant. The smaller the variations in the parameter values of the linear model over the data domain, the closer the underlying model is to a linear model. A curve that is close to zero over the whole data domain indicates that a smaller model with fewer regressors could be better (assuming the same range of all signals).

Display the linearization of the nonlinear model versus the data samples.

In[21]:=

Identifying the Dynamics of a DC-MotorBias-Variance Trade-Off: Avoiding Overfitting


Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information



 © 2009 Wolfram Research, Inc.  Terms of Use  Privacy Policy |
Sign up for our newsletter: