我正在尝试运行 Xu 的 DONUT 算法的这个 repo,但是我遇到了一个我不太理解的错误。自述文件说我应该按如下方式加载 raw_data:
timestamp, values, labels = ...
# If there is no label, simply use all zeros.
labels = np.zeros_like(values, dtype=np.int32)
# Complete the timestamp, and obtain the missing point indicators.
timestamp, missing, (values, labels) = \
complete_timestamp(timestamp, (values, labels))
但是,当我这样做时,我收到此错误:
ValueError: The shape of ``arrays[0]`` does not agree with the shape of `timestamp` ((109577, 11) vs (109577,))
这对我来说没有意义,因为我想不出时间戳是 11 暗数组的原因。当我将值作为时间戳 arg 传递时,我得到“时间戳必须是一维数组”
很困惑,希望有人能解释一下。
以下是代码中的检查:
if len(timestamp.shape) != 1:
raise ValueError('`timestamp` must be a 1-D array')
has_arrays = arrays is not None
arrays = [np.asarray(array) for array in (arrays or ())]
for i, array in enumerate(arrays):
if array.shape != timestamp.shape:
raise ValueError('The shape of ``arrays[{}]`` does not agree with '
'the shape of `timestamp` ({} vs {})'.
format(i, array.shape, timestamp.shape))