为什么在我将windowed_dataset放入python后X_train、y_train和x_test和y_test的值变为-100(深度学习预测)

原文标题why the value of X_train, y_train and x_test and y_test become – 100 after I put windowed_dataset in python (prediction with deep learning )

我的代码有问题,我不知道为什么 xtrain ytrain xtest ytest 的值减小 100 (time_step) – 1 因为我保持了这样的相同值 (((1237, 100), (1237,), ( 310, 100), (310,)))

train_data, test_data = price_series_scaled[0:1237], price_series_scaled[1237:]

len(train_data)  1237
len(test_data)   310

train_data.shape, test_data.shape
((1237, 1), (310, 1))

def windowed_dataset(series, time_step):
    dataX, dataY = [], []
    for i in range(len(series)- time_step-1):
        a = series[i : (i+time_step), 0]
        dataX.append(a)
        dataY.append(series[i+ time_step, 0])
        
    return np.array(dataX), np.array(dataY)

X_train, y_train = windowed_dataset(train_data, time_step=100)
X_test, y_test = windowed_dataset(test_data, time_step=100)


X_train.shape, y_train.shape, X_test.shape, y_test.shape
((1136, 100), (1136,), (209, 100), (209,))

原文链接:https://stackoverflow.com//questions/71665880/why-the-value-of-x-train-y-train-and-x-test-and-y-test-become-100-after-i-put

回复

我来回复
  • 暂无回复内容