ADIOS - I-NERGY Apply Model
The docker contains the scripts to apply the trained model, trained saved in the resource folder.
In this phase, we use the previously trained models to label the unknown alarms. Scikit-learn allows to save trained models to binary files on disk, so in this phase we first load our pretrained model and then we load also the one-hot encoder in case we are willing to use categorical data, or the text processing module if we want to use the text-based classification. Once the pre-trained model is loaded, it can be used to predict the labels of unknown alarms.
The node has 2 gRPC functions:
set_status - Used to detect when training is completed so that applying model can start
set_models - Set training model input files
The module starts by starting the gRPC server. First input models, apply file (full dataset) and output file are initialised. Then the set_models gPRC call is called by the orchestrator. The set models method sets the filenames in the shared folder as a result of training node execution.
The next gRPC call is set_status which will be called multiple times by the orchestrator until the “done” status is received. After “done” status is received it means that we have the training models in the shared folders and we can start applying the machine learning models.
After that training models and full dataset are loaded and the apply machine learning script is executed outputting the processed dataset into a csv file in a shared folder. In the prototype application database records are instead updated so that the results can be visualised in Grafana server.
Protobuf definition contains 2 types TrainingModels and TrainingStatus as well as one service which contains 2 methods set_models and set_status.