#include "Evaluator.h" #include #include "SystemConfig.h" Evaluator::Evaluator() { //initialize Linear Regression Analysis on Residual Current Register CappedStorage* storageP = DataModel::Instance()->getPermanentData(ModbusRegister::BENDER_Residual_current); if(storageP != nullptr){ MLAlgorithms.push_back(std::make_unique(storageP)); } else LOG(ERROR) << "Tried to invoke ML-Algorithm on non permanent or non existing parameter storage"; } inline std::ostream& operator<<(std::ostream& os, std::vector& vec) { std::for_each(vec.begin(), vec.end(), [&os](float a) {os << a << " "; }); return os; } //update all registered models std::vector Evaluator::evaluate() { std::vector alerts; for(auto &a: MLAlgorithms){ MLAlert alert = a->updateModel(); if(alert.type != CustomAlertTypes::NO_ALERT) alerts.push_back(alert); } for(auto &a: alerts) LOG(WARNING) << a.message; return alerts; }