When a deep RNN has been trained and the model constructed, the values of the target variable from test set can be predicted. The RNN model takes the test data as an input and returns the prediction. Now, by adjusting the values in the input data, it can be seen how the adjustments effect in the predictions.

This creates an opportunity to find out what should be done in the data in order to minimize or maximize the target values. As a practical illustration of finding the appropriate variable values for maximizing/minimizing the target values, we present a car-oriented example. Suppose you drive a car and your aim is to maximize driving speed and to minimize gas consumption, respectively. In other words, your goal is to achieve the best possible efficiency of your driving. There are now some circumstances that will affect your performance and that you have to pay attention to, such as the weather conditions, the shape of the road, the speed limits and traffic rules. You cannot modify these conditions, but you can react to them by modifying all the contributing and adjustable factors, like using the gear, brake and gas pedals as reasonably as possible under the existing conditions.

Now, assume that we have collected data from the aforementioned driving experiments. The amount of data collected is very large and there exist several instances from all the different circumstances. Table 1 shows an example of the observation matrix. The red variables measure unadjustable conditions and the green variables measure adjustable factors.

### Table 1: An example of the observation matrix in the car driving example.

After the data exploration and preprocessing stages, we can fit an RNN model that is able to predict the driving efficiency. Then we aim to find the optimal test values for the adjustable factors, i.e, to solve how the car should be driven optimally under all different conditions.

The optimal test values for the adjustable variables can be found by completing the following steps:

Get some data sample from one of the different circumstances.

Modify the values of the adjustable variables.

Predict the efficiency with the RNN using the modified test data.

Repeat steps 2 and 3 until a sufficient number of the possible adjustments have been tested.

Choose the adjustments that provide the highest prediction value for the efficiency.

After completing these steps for all the different circumstances separately, we have obtained the optimal test values to maximize the driving efficiency. Now, we can use the test values in the whole test set and see how the prediction values for the driving efficiency change. Figure 1 illustrates example curves of successful parameter optimization.

### Figure 1: Example curves after optimizing the parameters.

Now, let us put all the pieces together and think about how these techniques presented in this blog text series can be applied in the process optimization, i.e how a plant could benefit from these methods. As described in part 1, the whole project starts by collecting data from the plant and completing exploratory data analysis and data preprocessing.

The next stage is building an RNN model as described in part 2. We have to define the target variable and all the predictive variables to fit the RNN model. One good choice for the target variable is the process efficiency, whereas predictive variables, we should use every variable gained from measurement points that are influential with respect to efficiency. Besides variable selection, we need to think about how to divide the data. When splitting the data into time windows, the length of a window should be chosen by considering how long a single phenomenon lasts in the production process.

When the RNN model has been trained, we can find the best test values as described in this text. These test values are actually *the optimal process values* in this concept. We need to get separate test sets from all process conditions and to find the optimal values for the tunable variables. Then we have the knowledge of how the efficiency can be maximized.

Should we believe the results without questioning them? The answer is, no. Before we go further, the optimal process values must be tested in practice. The RNN model has given us suggestions to maximize the efficiency and next, we will examine if some desirable changes occur in a real world scenario.

If the real world scenario, also called field test, shows that the actual process efficiency increases by means of the RNN model, the plant may gain significant financial benefits and the project has been successful. The next step is to think together about how to continue in the future. Are there still more data to use, more opportunities to improve the RNN model, more problems to solve with data analytics, or a need for an advanced data analytics platform? If positive, then we know how to continue improving your business.