## 2 Materials and Methods
### Machine Learning for Irradiance Forecasting
Each input or example is a 3-channel RGB image from the Pi camera. In the current configuration, 3 images taken 5 seconds apart at low, medium, and high exposure times are fused using the Mertens algorithm into one raw image. As mentioned, this approach reduces over-exposure and washout in the circumsolar region. The 1024 \(\times\) 768 JPEG forms the basic input measurement for both the optical flow and machine learning algorithms. Low level cumulus clouds between the sun and the PV arrays have the greatest effect on the DNI, hence on GHI. For that reason, and to satisfy the need for dimensionality reduction, the first preprocessing step is to locate the area in the image that surrounds the sun and extract a 128 \(\times\) 128 subimage. Several approaches to locating the sun in the image are possible. Calculating the zenith angle from the SOLPOS program, finding true North, and then mapping physical to pixel coordinates would require extensive calibration. It was decided to use a simple robust image processing approach that finds the maximum intensity in the image. On a clear day, this always locates the sun, but occasionally when the sun is totally obscured by broken clouds, the brightest point in the picture is actually sunlight reflected off of a nearby cloud. This can be observed in a time lapse video clip in which for a few frames the sun is not at the center of the sub-image. While the cause of some transient errors, it never lasts long and does not happen when the sun is totally obscured by a uniform cloud deck without breaks. Figure 15 shows the low exposure image used to locate and center the sun and the resulting raw fused image that will ultimately become the input to the neural networks. Lastly the subimage will be resized to a point (8 \(\times\) 8) where the neural networks will train in a reasonable amount of time. In supervised learning, the neural networks require labeled training examples: ordered pairs (\(x,y\)  
Figure 14: Point and click GUI for Rapidminer allows easy model development. where \(x\) is the input vector, in this case the extracted subimage \(img\), and \(y\) is the measured irradiance in units of Watts/m\({}^{2}\) at the time the picture was taken. Since new images are fused every 15 seconds, GHI values were treated as constant on a 60 second interval for the purposes of assigning labels for the neural network images. Many different metrics are used in data analysis and ML for evaluating model performance. Table 1 lists common ones for solar forecasting. \(A_{t}\) is the actual value, \(F_{t}\) the forecast value, and \(\mu\) the mean; the summation over \(t\) can be over all observations in the ML context or over the values of a time series. The metrics provide a posteriori error bounds upon which utilities can make economic decisions. MAPE is relative L\({}_{1}\) error, normalized for number of observations and converted to percent. When the denominator of a fraction is close to zero, \(\mu\) is used instead of \(A_{t}\), a common practice when predicting spot electricity prices. Some metrics such as L\({}_{1}\) are more robust-less sensitive to outliers-than the classical RMS error norms.