## 4 Methodology
### Machine-Learning Model Development  
#### 4.4.1 Regression Machine Learning Models  
Forecasting LPG C5 content solely from temperature and pressure data is a challenging task. In Figure 8, C5 content could reach very disparate values: from values close to zero to a range of valid values when considering the LPG specifications, and some peaks corresponding to samples with C5 concentrations well above the specification ranges. In our research, we developed and compared six models. These models include two baseline models and four models that aim to provide enhanced forecasts, and which we describe below:  
* **Baseline 1 (C5 median)**: our prediction is the median of C5 values observed in the data set for model training;
* **Baseline 2 (LiR)**: linear regression to predict C5 content based on raw temperature and pressure sensor measurements (P1 and T2 from Figure 1, described in Feature Group ID #1 at Table 3);
* **Model 1 (LiR)**: linear regression considering raw sensor measurements of P1 and T2 sensors at fifteen-minute intervals (see Figure 1, and all features described in Table 3), for the time range as presented in Figure 3;
* **Model 2 (SVR)**: Support Vector Regressor [84], which takes into account most relevant features assessed over all created features;
* **Model 3 (MLPR)**: Multi-layer Perceptron regressor [85], which takes into account most relevant features assessed over all created features;
* **Model 4 (VR)**: composite model introduced in Figure 9, and described in detail later in this section. The model takes into account most relevant features assessed over all created features. Figure 8: Measured C5 content in laboratory samples over time. Please notice that the samples are taken at irregular intervals. On (**A**) we present measurements from _Unit A_, while on (**B**) we present measurements from _Unit B_. We expect that most of the time, C5 content levels remain within a threshold. Thus, predicting the median of C5 content observed in the past (_Baseline 1_) provides a realistic estimate that is not sensitive to outliers. Furthermore, we expect good machine learning models to surpass such a baseline, showing they learned patterns that allow more precise forecasts. Although the _Baseline 2 (LiR)_ is a linear regression model that forecasts C5 content based only on raw temperature and pressure readings obtained from two sensors, _Model 1 (LiR)_ provides insights on how the forecasting quality is improved by introducing a more extensive set of features (all features presented in Table 3), considering [PERSON]'s law and [PERSON]'s equations, given the assumptions and simplifications described in Section 4.3. _Model 2 (SVR)_ and _Model 3 (MLPR)_ were built based on the SVR and MLPR algorithms, which were frequently reported in the related work. We instantiated the _Model 2 (SVR)_ model with a radial basis function kernel, using an epsilon value of 0.1 and non-scaled L2 regularization. We did not impose constraints on the number of iterations required by the solver. _Model 3 (MLPR)_ was instantiated with a single hidden layer of a hundred neurons, using a ReLU activation [86] and the Adam solver [87]. The learning rate was set to a fixed constant (0.001), and we trained it for 300 iterations. A validation set was created randomly sampling 0.1 of the training set. We designed _Model 4 (VR)_ (see Figure 9) as a voting regressor (VR) [88] that takes the input from four estimators to decide on the final forecast. Two estimators are CatBoost [89] models ((A) and (B)), each of them optimized with a different metrics function. (A) is optimized for the Root Mean Square Error (RMSE) metric, which tends to give more weight to points further away from the mean, and thus focuses on better adjusting off-specification values. On the other side, (B) is optimized for the Mean Absolute Error (MAE), which is not sensitive to outliers and ends up providing better estimates on the usual C5 levels. For both models, we use the expectile loss [90], which places unequal weights on disturbances.