def _predict_as_table(self, prediction, confidence):
from Orange.data import Domain, ContinuousVariable
means, lows, highs = [], [], []
n_vars = prediction.shape[2] if len(prediction.shape) > 2 else 1
for i, name in zip(range(n_vars),
self._table_var_names or range(n_vars)):
mean = ContinuousVariable('{} (forecast)'.format(name))
low = ContinuousVariable('{} ({:d}%CI low)'.format(name, confidence))
high = ContinuousVariable('{} ({:d}%CI high)'.format(name, confidence))
low.ci_percent = high.ci_percent = confidence
mean.ci_attrs = (low, high)
means.append(mean)
lows.append(low)
highs.append(high)
domain = Domain(means + lows + highs)
X = np.column_stack(prediction)
table = Timeseries.from_numpy(domain, X)
table.name = (self._table_name or '') + '({} forecast)'.format(self)
return table
评论列表
文章目录