# PV Fault Detection Using Positive Unlabeled Learning
## 2 Materials and Methods
### The MLRf Algorithm  
PV fault detection and classification are different from typical classification problems as the feature set is typically small, while vast quantities of unlabeled data can be generated automatically. Our dataset has thousands of measurements but only 10 features, and some of those features such as the gamma ratio are calculated as combinations of other features. Because our feature set is small and the problem complex, linear classifiers may underfit the data, yet because a PU dataset has many missing labels, most non-PU non-linear classifiers such as neural networks will overfit the data to the few labeled datapoints. The MLR algorithm by itself is a powerful general-purpose PU learning algorithm, analogous to standard classification algorithms such as logistic regression, support vector machines, or artificial neural networks for fully labeled data and by itself includes no feature enhancement or engineering. To better handle the small solar fault detection feature set, we introduce the MLRf algorithm in this paper. The MLRf algorithm shown in Figure 1 uses the MLR algorithm, but also incorporates a feedback loop to perform custom feature engineering--enhancing the feature set to enable non-linear classification that does not overfit or underfit the data. This automates some of the preprocessing steps that are manually required by other algorithms. The proposed MLRf algorithm consists of the following five steps. 1. An initial classification model is learned using the original MLR algorithm from [13] and described in Section 2.2. 2. The MLR model produced in Step 1 above is a weighted combination of \(n\) feature variables. As the original feature data were mean normalized as part of training, the most influential features in the model are those with the highest magnitude weights. Figure 1: The proposed feedback-enhanced modified logistic regression (MLRf). This allows us to sort the features by importance to the model. The MLRf algorithm selects the top \(k\leq n\) most important features by magnitude for enhancement. 3. Feature enhancement is performed by adding \(p\)-level polynomial combinations of the selected features. For example, if \(p=2\) an enhancement of any two pairs of original features \(x_{1}\) and \(x_{2}\) would return the enhanced feature space \(x_{1},x_{1}^{2},\ x_{2},\ x_{2}^{2},\ x_{2}^{2},\ \text{and}\ x_{1}\cdot x_{2}\). If \(p=3\), enhancement would include cubic values and combinations such as \(x_{1}\cdot x_{2}\cdot x_{3}\), and so forth. The purpose of this expansion is to increase the dimensionality of the dataset to allow for a more flexible non-linear decision boundary that is better able to accommodate the complexity of the solar fault data space. A linear decision boundary in this higher dimensional space is equivalent to a non-linear decision boundary in the original feature space. 4. Once the feature space has been expanded, regularization methods or additional feature manipulation can be performed using a dimensionality reduction algorithm such as PCA (Principal Component Analysis) to capture the dimensionality of the enhanced feature set that incorporates more than 95-99% of the variability of the space. This eliminates or minimizes any enhanced features that do not substantially contribute to the final classification. 5. Finally, the newly expanded feature space is sent back through the original MLR classifier for final classification with a now potentially non-linear classification boundary. In addition to the standard hyperparameters such as the learning rate and number of epochs in the MLR algorithm, the MLRf introduces \(k\), the number or percentage of important features to be enhanced, and \(p\), the level of polynomial enhancement described in step 2 above. If PCA is used in step 4, then the number of retained components becomes an additional hyperparameter. Regularization may be preferred for this reason. Once the model has been created, it can be applied to new data in real time.