in forecastMetrics/forecastMetrics.py [0:0]
def publishMetrics(currentDay,currentDayRealData,config):
total_dif=0
metricDataList=[]
metricTimeStamp=getTimestampByDate(currentDay)
for p in vars.forecastPList:
metricDataList=[]
for item in vars.ItemList:
if (item.upper() in currentDayRealData):
realValue=float(currentDayRealData[item.upper()])
forcastValue=float(vars.ForcastData[tranformDateToString(currentDay)][item.lower()][p])
if (realValue is None or realValue==0):
state_abs=0
else:
state_abs=(abs((forcastValue-realValue)/realValue))*100
total_dif=total_dif+state_abs
# currently not need by state data for model monitor
#metricDataList.append(getMetricData(metricTimeStamp, item, state_abs, p))
avarage_abs=total_dif/len(vars.ItemList)
logger.info("averageABS is "+str(avarage_abs) + "============for :"+tranformDateToString(currentDay) +"====for p=" +p)
metricDataList.append(getMetricData(metricTimeStamp, config["modelName"], avarage_abs, p))
putForecastMetricsData(metricDataList)