# The Integration of Internet of Things and Machine Learning for Energy Prediction of Wind Turbines
## 3 ML for Wind Energy Prediction
### Machine Learning and Wind Energy Forecast
#### 3.2.1 Linear Regression  
Linear regression, sometimes known as LR, is a prevalent and extensively utilized modeling technique in the fields of statistics and machine learning. The objective outcome is to establish a linear relationship between the input and target variables. The model postulates a linear amalgamation of the input features to predict the continuous output variable. In order to calculate the coefficients of these input variables, several optimization approaches, such as least squares, are utilized [32]. LR is an excellent option when there are linear relationships between variables due to its simplicity and ease of comprehension. Multiple linear regression (MLR) is an appropriate form of linear regression for this particular situation. MLR produces equations that establish a connection between several input variables (\(x_{n}\)) and a target variable (\(y\)). \[y=w_{0}+w_{1}x_{1}+\cdots+w_{n}x_{n} \tag{8}\]  
Here, \(n\) represents the total number of input variables, \(w_{n}\) denotes the coefficient for \(x_{n}\), and \(w_{o}\) refers to the intercept. Regularization approaches, such as the inclusion of a penalty term on the model's input variables, can restrict the freedom of the input variables during the learning process, hence improving the accuracy of predictions on data that were not used for training. MLR is a statistical technique that estimates the value of a dependent variable based on multiple independent variables. The objective of MLR is to construct a precise mathematical model that accurately depicts the linear relationship between the independent variables (\(x_{n}\)) and the dependent variable (\(y\)) being studied [33]. The primary MLR model is described as:  
\[y=\beta_{0}+\beta_{1}x_{1}+\cdots+\beta_{m}x_{m}+\varepsilon \tag{9}\]  
* \(y\) is the dependent variable;
* \(\beta_{0}\) is the intercept;
* The coefficients \(\beta_{1},\ldots,\ \beta_{m}\) represent the values assigned to the independent variables \(x_{1},\ \ldots,\ x_{n}\). The intercept, often known as the \"constant\", in a regression model signifies the average value of the response variable when all predictor variables in the model are set to zero. The intercept, denoted as \(\beta_{0}\), is the estimated value of \(y\) when all \(x_{i}\) values are equal to zero. The baseline level of \(y\) (dependent variable) is established when the explanatory variables have no influence. The coefficients represent the weights of each independent variable, indicating the extent to which each variable contributed to the prediction. The assumption of independence in linear regression is crucial. Figure 15 displays the residuals across the order of the test data. There are no discernible patterns or systematic trends, suggesting a random distribution of the residuals around zero. This suggests that the assumption of independent residuals is probably satisfied, indicating there are no  
Figure 14: Diagram of K-fold forward cross-validation. strong correlations between consecutive errors. This suggests that the validity of the model was positively affirmed in this regard. In linear regression, one assumption is that the residuals should have a normal distribution [34]. Figure 16 shows that the residuals are roughly normally distributed, with a peak around zero. It closely approximates a normal distribution, which is suitable for the normality assumption. Minor deviations from normality, especially toward the tails, are present, but these do not seem significant enough to invalidate the assumption of normality. The implementation of the linear regression technique, along with cross-validation results, yielded the aforementioned metrics [28]:  
* R\({}^{2}\) (0.6199): This means that about 61.99% of the variance in the target variable can be explained by the model's features. This indicates a moderately strong fit, but there is still 38% of variability in the target that the model does not explain. Figure 16: Distribution of residuals using histogram. Figure 15: Residuals over time of the test data.