# A Novel OFDM Format and a Machine Learning Based Dimming Control for LiFi
## 7 Application of ML on Hybrid OFDM Forms  
As a subset of artificial intelligence, ML was widely used for tasks such as prediction, classification, and detection in various application scenarios [32; 33; 34; 35; 36; 37; 38]. Some of these applications are in fields of biomedical engineering [32; 38], electrical engineering [33], petroleum engineering [34], computer engineering [35], urban planning engineering [36], and software engineering [37]. ML can also be useful in the context of telecommunication and LiFi. ML regressions are used to predict numerical values based on some system attributes. A regression model can be developed using a set of training samples. This model can produce predicted results. The effectiveness of a regression model can be evaluated using the coefficient of determination or R\({}^{2}\) score and root-mean-square error (RMSE). This R\({}^{2}\) is a goodness of fit measurement of the models, which indicates how well the predicted values fit or make an approximation of the actual samples [38]. Hence, a unity value of R\({}^{2}\) means that the regression model is a perfect fit for the actual samples. On the other hand, RMSE indicates how concentrated the data samples are around the best-fitted line. An RMSE value near zero means there is very low predicted errors, and the model fits the actual data points [38]. This section discusses the application of ML in finding the individual components of hybrid OFDM forms. The methods used in this section can be applied to any hybrid optical OFDM, but we focus our study on DPO. In this case, ML regressors can be used to find the appropriate constellation size of one component of DPO, that is, DCO or PAM-DMT, when the other component is given and when the target dimming level is known. To apply regression algorithms, a dataset was generated by simulating the DPO-based LiFi system using the MATLAB tool. The obtained dataset has 200 sample values, and the samples are randomly placed in the dataset. In the dataset, the input attributes are the subcarrier number \(N\), the number of symbols, the constellation size of the PAM-DMT element denoted as \(M_{PAM}\), and the dimming level. The output or target attribute of the dataset is the constellation size of the DCO element denoted as \(M_{DCO}\). The term \(E_{b(elec)}/N_{O}\) was varied to keep the BER to a constant value of \(10^{-3}\). Python programing language was used for analyzing the data and generate the plots. For that, the Anaconda distribution package, Scikit-learn library, Jupiter notebook, and Spyder (version 3.3.3) were used to simplify package management and deployment of Python. Different regression algorithms, including linear regression and polynomial regression, were applied. In regressions, the output depends on single or multiple independent variables. The general equation for multiple variable linear regression is as follows. \[y=m_{0}+m_{1}x_{1}+m_{2}x_{2}+\ldots+m_{n}x_{n} \tag{15}\]In (15), \(x_{1}\), \(x_{2}\),..., \(x_{n}\) are the input variables, and \(m_{0}\), \(m_{1}\),..., \(m_{n}\) are the estimators of the regression coefficient. On the other hand, polynomial regressions can be expressed in the following format. \[y=m_{0}+m_{11}x_{1}+m_{21}x_{2}+\ldots+m_{n1}x_{n}+m_{12}x_{1}{}^{2}+m_{22}x_{2} {}^{2}+\ldots+m_{n2}x_{n}{}^{2}+\ldots+m_{nn}x_{n}{}^{n} \tag{16}\]  
In (16), \(m_{0}\), \(m_{11}\), \(m_{21}\)... \(m_{n1}\), \(m_{12}\), \(m_{22}\), \(m_{n2}\), \(m_{nn}\) are the estimators of the regression coefficient, and \(n\) is the degree of the polynomial. In the case of our experiments with polynomial regression, the order was varied from 2 to 5. The data were split into training and testing samples. The percentage of testing and training samples were varied. Investigations were conducted for a testing size of 10%, 20%, and 30% of the total samples, where the remaining samples were used for training the model. The regression coefficients were estimated using least square algorithms.