# From DevOps to MLOps: Overview and Application to Electricity Market Forecasting
## 4 Case Study 1: Forecasting an Hourly Day-Ahead Electricity Market Using an MLOps Pipeline
### FCR-N Forecasting Results  
Figure 13 shows the one-day predicted vs. actual price prediction for the FCR-N market price. The ML model runs daily, and the predicted values are stored in the database. A Django-based web UI was designed for viewing these values and hosted in the CSC cloud as an SaaS, as shown in Figure 14. This SaaS service can also act as a REST API to expose the predicted data to a third-party system. Figure 11: ML life-cycle management with MLflow. Figure 12: ML artifact storage using the MinIO object store. Case Study 2: National Electricity Consumption Forecast Adapted from the Price Forecast MLOps Pipeline  
In the above use case, the MLOps pipeline was defined and implemented as shown in Figure 7, while in this use case, the same MLOps pipeline was adapted with minimal changes to forecast the Finnish national electricity consumption. The data were collected from the Finnish Transmission System Operator (TSO) via an online API. The TSO defines the electricity consumption as follows:  
\[\text{Consumption}=\text{Production}+\text{Import}-\text{Export} \tag{1}\]  
This use case was implemented with all of the pipeline components defined in Figure 7. However, the following changes were made to the previous MLOps source code:  
* In the TFT, _the FCR_N price_ variable was replaced with _electricity_consumption_ as the prediction variable. * In the GIT, a new feature branch was created. * A new experiment name was created for tracking the ML model parameters using MLflow. * A new Jenkins project as created, and MLOps pipelines were incorporated using the same Jenkinsfile. * Unit test cases are updated. * To explore the predicted values via web UI, as shown in Figure 14, the corresponding legend and variable names were changed. Except for the test cases, most of the abovementioned changes were in the configuration files and, most importantly, the same MLOps pipeline and tools were reused on the same cloud platform. Figure 15 shows the one-day predicted vs. actual electricity consumption forecasts for Finland. Figure 14: Web UI for exploring the model prediction values. Figure 13: Predicted vs. actual price for 16 April 2020. Case Study 3: National Electricity Generation Forecast Adapted from the Price Forecast MLOps Pipeline  
In the previous use case, electricity consumption was forecasted by adapting to the MLOps pipelines created for FCR-N market price forecasting. In this example, electricity production was forecasted, and the MLOps pipeline changes made for the previous use case were used here. As in the electricity consumption forecasting, the data were collected from the Finnish TSO via an online API. However, the following changes were made to the previous MLOps source code:  
* In the TFT, the _electricity_consumption_ variable was replaced with _electricity_production_ as the prediction variable. * In the GIT, a new feature branch was created. * A new experiment name was created for tracking the ML model parameters using MLflow. Creating a new experiment name is helpful in grouping the new experiments within a project or use case. * A new Jenkins project was created, and MLOps pipelines were incorporated using the Jenkinsfile used for the above use case. * Unit test cases were updated. * To explore the predicted values via web UI, as shown in Figure 14, corresponding legend and variable names were changed. Figure 16 shows the one-day predicted vs. actual electricity production forecasts for Finland. Case Studies 2 and 3 were implemented with minimal work by adapting to the implementation of Case Study 1. Case Studies 1 and 2 both used the same MLOps pipeline structure and the same set of tools. This generalization is applicable while forecasting similar variables--for instance, wind power forecasting or photovoltaic power generation forecasting--with 1 h as the sampling interval. However, if the sampling interval changes--for example, to 15 min--considerable work must be performed in the MLOps pipeline, such as \"Data ingestion\" and \"Prediction service\".