# 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.3 Lasso Regression  
LASSO regression, also known as Least Absolute Shrinkage and Selection Operator regression, is a commonly employed method for reducing the size of coefficients and choosing variables in regression models. The computationally demanding nature of statistical software is no longer concerning due to developments in processing power and integration. The objective of LASSO regression is to identify the variables and corresponding regression coefficients that minimize the prediction error of the model [41]. The parameter \(\lambda\), often denoted by alpha, serves as the L1 penalty or shrinkage parameter, controlling the degree of regularization applied to the model [42]. Regularization helps prevent overfitting by penalizing large coefficients. A higher value of \(\lambda\) increases the penalty for large coefficients, which causes more coefficients to be shrunk towards zero, effectively removing less important features from the model; a lower value of \(\lambda\) lets the model retain more features, which might lead to overfitting should too many irrelevant features be included. During the configuration of the Lasso model and grid search using GridSearchCV, the algorithmic process selects the best value of \(\lambda\) based on the training process and evaluations from cross-validation. Multicollinearity can affect the selection of the optimal \(\lambda\) during model training. The goal is to find a \(\lambda\) value that maintains the model's performance while simultaneously minimizing overfitting. The \(\lambda\) value found was 0.0001. The results of the variance inflation factor (VIF) calculation show that the variables windspeed_100m, windspeed_10m, and windgusts_10m have high VIF values (49.51, 135.40, and 51.69). These values indicate that there is significant multicollinearity among these variables. High multicollinearity can affect the reliability of the model parameters, and there may be difficulties in interpreting the effect of individual variables on the target variable. The process of calculating and removing features with a high VIF index did not result in any improvements. LASSO conducts regression analysis using the below equation, where \(N\) represents the sample size of \(a\) and \(\beta,j\) denotes the parameter coefficients, and \(\hat{a}\) represents the prediction. \[(\hat{a},\hat{\beta})=\text{argmin}\left(\frac{1}{N}\sum_{i=1}^{N}\left(y_{i} -a-\Sigma_{j=1}^{p}x_{i,j}\times\beta_{j}\right)^{2}\right) \tag{12}\]  
The provided formula can be compacted and represented in Lagrangian form, as illustrated in the equation [43]. The equation below demonstrates that L1 regularization is the preferred method in LASSO. L1 regularization incorporates the absolute value of feature coefficients as a penalty term to regulate the impact of the features. \[(\hat{a},\hat{\beta})=\text{argmin}\left(\frac{1}{N}||y-X\beta||_{2}^{2}+ \lambda||\beta||_{1}\right) \tag{13}\]  
The implementation of the Lasso regression, along with cross-validation results, yielded the aforementioned metrics [44]:  
* R\({}^{2}\) (0.6110): This means that 61.10% of the variance in the target variable (y) is explained by the Lasso regression model. It is a moderate grade, demonstrating that the model captures a good percentage of the variability; however, there is potential for improvement. * Adjusted R\({}^{2}\) (0.6108): The Adjusted R\({}^{2}\) value is quite close to the R\({}^{2}\) score (0.6108 vs. 0.6110). This shows that the model's performance does not diminish when accounting for the amount of predictors used. Since the model is not overfitting with irrelevant variables, the adjusted R\({}^{2}\) stays virtually the same as the regular R\({}^{2}\). * MSE (0.0319): A lower MSE (0.0319) shows the model's predictions are pretty close to the actual values, while there are some inaccuracies. * RMSE (0.1787): RMSE is 0.1787, suggesting on average, the predictions are wrong by around 0.1787 units of the target variable, which is a substantial amount of inaccuracy.