df = pd.read_csv('F:/series.csv')
train, validate, test = df[0:60], df[60:80], df[80:100]
sc = MinMaxScaler(feature_range = (-1, 1))
train = sc.fit_transform(train)
validate = sc.fit_transform(validate)
test = sc.fit_transform(test)
train = train.reshape((len(train),1))
test = test.reshape((len(test),1))
validate = validate.reshape((len(validate),1))
n_input = 5
n_features = 1
generator_train = TimeseriesGenerator(train, train, length=n_input, batch_size=2)
generator_validate = TimeseriesGenerator(validate, validate, length=n_input, batch_size=2)
generator_test = TimeseriesGenerator(test, test, length=n_input, batch_size=2)
model = Sequential()
model.add(LSTM(200, return_sequences = True, input_shape=(n_input, n_features)))
model.add(Dropout(0.2))
model.add(LSTM(200))
model.add(Dense(units = 1))
model.compile(loss='mean_squared_error', optimizer='adam')
history = model.fit_generator(generator_train, epochs= 100, validation_data = generator_validate)
model.evaluate_generator(generator_test)
prediction = model.predict_generator(generator_test, steps = 5)
prediction.shape
(10,1)
test.shape
(20,1)
Это меня смущает, как решить проблему? Как оценить прогнозируемые и тестовые данные? Какую ошибку я совершаю?