if t0 is None:
t0 = ts
yield (ts - t0) / 1000, X, timeval
def save_timeseries_prediction(self, prediction, model):
logging.info("saving "%s" prediction to "%s"", model.name, self.name)
After Change
// Build final result
t0 = None
result = []
for bucket in buckets:
X = np.zeros(nb_features, dtype=float)
timeval = bucket["time"]
ts = str_to_ts(timeval)
for i, feature in enumerate(features):
agg_val = bucket["values"].get(feature.name)
if agg_val is None:
if feature.default is np.nan:
logging.info(
"missing data: field "%s", metric "%s", bucket: %s",
feature.field, feature.metric, timeval,
)
agg_val = feature.default
X[i] = agg_val
if t0 is None:
t0 = ts
result.append(((ts - t0) / 1000, X, timeval))return result
def save_timeseries_prediction(self, prediction, model):
logging.info("saving "%s" prediction to "%s"", model.name, self.name)