Commit 5e73ffe8 authored by Andreas Tsagkaropoulos's avatar Andreas Tsagkaropoulos
Browse files

Correction of complete time series creation

Correction of the handling of an exception when prediction cannot be made
parent 9e6b1c58
......@@ -86,8 +86,11 @@ data_to_process <- data_to_process[data_to_process[[time_field_name]]>oldest_acc
#Fail-safe default
df1 <- xts(as.numeric(data_to_process[,attribute_to_predict]),anytime(data_to_process[,time_field_name]))
date_time_init <- anytime(data_to_process[,time_field_name])
date_time_complete <- seq.POSIXt(from=min(date_time_init),
to=max(date_time_init),by=time_unit_granularity)
date_time_complete <- seq.POSIXt(
from=as.POSIXct(min(date_time_init),origin = "1970-01-01"),
to=as.POSIXct(max(date_time_init),origin = "1970-01-01"),
by=time_unit_granularity
)
df2 <- merge(df1,xts(,date_time_complete))
mydata <- na.approx(df2)
colnames(mydata)<-c(attribute_to_predict)
......
......@@ -147,7 +147,7 @@ def calculate_and_publish_predictions(prediction_horizon,maximum_time_required_f
try:
prediction = predict_attributes(State.metrics_to_predict,State.next_prediction_time)
except Exception as e:
print_with_time("Could not create a prediction for some or all of the metrics for time point "+State.next_prediction_time+", proceeding to next prediction time. The encountered exception trace follows:")
print_with_time("Could not create a prediction for some or all of the metrics for time point "+str(State.next_prediction_time)+", proceeding to next prediction time. The encountered exception trace follows:")
print(e)
continue
for attribute in State.metrics_to_predict:
......
Supports Markdown
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