Commit 17e05436 authored by Anna Warno's avatar Anna Warno
Browse files

message horzion name corrected

parent 3c3fb4fd
......@@ -27,7 +27,7 @@ class InfluxdbPredictionsSender(object):
"time": datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%SZ"),
"fields": {
"value": msg[metric]["metricValues"],
"prediction_horizon": msg[metric]["horizon"],
"prediction_horizon": msg[metric]["predictionTime"],
},
}
try:
......
......@@ -79,13 +79,14 @@ def predict(
msg = {
target_column: {
"metricValues": prediction[-1][-1][2].item(),
"level": "TODO",
"timestamp": timestamp,
"level": 1, # TODO
"timestamp": int(time.time()) * 1000,
"probability": 0.95,
"confidence_interval": abs(
(prediction[-1][-1][-1] - prediction[-1][-1][0]).item()
), # quantiles difference
"horizon": prediction_hor * m,
"confidence_interval": [
prediction[-1][-1][0].item(),
prediction[-1][-1][-1].item(),
], # quantiles difference
"predictionTime": timestamp + prediction_hor * m,
"refersTo": "TODO",
"cloud": "TODO",
"provider": "TODO",
......
......@@ -27,7 +27,7 @@ class InfluxdbPredictionsSender(object):
"time": datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%SZ"),
"fields": {
"value": msg[metric]["metricValues"],
"prediction_horizon": msg[metric]["horizon"],
"prediction_horizon": msg[metric]["predictionTime"],
},
}
try:
......
......@@ -7,6 +7,7 @@ import torch
from filelock import FileLock
from src.preprocess_dataset import Dataset
from pytorch_forecasting import TemporalFusionTransformer
import time
import logging
pd.options.mode.chained_assignment = None
......@@ -85,13 +86,14 @@ def predict(
msg = {
target_column: {
"metricValues": prediction[-1][-1][2].item(),
"level": "TODO",
"timestamp": timestamp,
"level": 1, # TODO
"timestamp": int(time.time()) * 1000,
"probability": 0.95,
"confidence_interval": abs(
(prediction[-1][-1][-1] - prediction[-1][-1][0]).item()
), # quantiles difference
"horizon": prediction_hor * m,
"confidence_interval": [
prediction[-1][-1][0].item(),
prediction[-1][-1][-1].item(),
], # quantiles difference
"predictionTime": timestamp + prediction_hor * m,
"refersTo": "TODO",
"cloud": "TODO",
"provider": "TODO",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment