arrigonialberto86 / deepar

Tensorflow implementation of Amazon DeepAR
MIT License
307 stars 97 forks source link

deepar main_output dimension issue #2

Closed andylau20017 closed 5 years ago

andylau20017 commented 5 years ago

ValueErrorTraceback (most recent call last)

in () 5 ts = TimeSeries(source_df, scaler=MinMaxScaler) 6 dp_model = DeepAR(ts, epochs=100) ----> 7 dp_model.instantiate_and_fit() /home/appops/app/notebook/hzliuerfei/deepar/deepar/model/lstm.pyc in instantiate_and_fit(self, verbose) 50 input_shape[0]), 51 steps_per_epoch=self.steps_per_epoch, ---> 52 epochs=self.epochs) 53 if verbose: 54 logger.debug('Model was successfully trained') /home/appops/app/anaconda2/lib/python2.7/site-packages/keras/legacy/interfaces.pyc in wrapper(*args, **kwargs) 85 warnings.warn('Update your `' + object_name + 86 '` call to the Keras 2 API: ' + signature, stacklevel=2) ---> 87 return func(*args, **kwargs) 88 wrapper._original_function = func 89 return wrapper /home/appops/app/anaconda2/lib/python2.7/site-packages/keras/engine/training.pyc in fit_generator(self, generator, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch) 2094 outs = self.train_on_batch(x, y, 2095 sample_weight=sample_weight, -> 2096 class_weight=class_weight) 2097 2098 if not isinstance(outs, list): /home/appops/app/anaconda2/lib/python2.7/site-packages/keras/engine/training.pyc in train_on_batch(self, x, y, sample_weight, class_weight) 1806 sample_weight=sample_weight, 1807 class_weight=class_weight, -> 1808 check_batch_axis=True) 1809 if self.uses_learning_phase and not isinstance(K.learning_phase(), int): 1810 ins = x + y + sample_weights + [1.] /home/appops/app/anaconda2/lib/python2.7/site-packages/keras/engine/training.pyc in _standardize_user_data(self, x, y, sample_weight, class_weight, check_batch_axis, batch_size) 1409 output_shapes, 1410 check_batch_axis=False, -> 1411 exception_prefix='target') 1412 sample_weights = _standardize_sample_weights(sample_weight, 1413 self._feed_output_names) /home/appops/app/anaconda2/lib/python2.7/site-packages/keras/engine/training.pyc in _standardize_input_data(data, names, shapes, check_batch_axis, exception_prefix) 139 ' to have ' + str(len(shapes[i])) + 140 ' dimensions, but got array with shape ' + --> 141 str(array.shape)) 142 for j, (dim, ref_dim) in enumerate(zip(array.shape, shapes[i])): 143 if not j and not check_batch_axis: ValueError: Error when checking target: expected main_output to have 2 dimensions, but got array with shape (1, 20, 1)
andylau20017 commented 5 years ago

when I run deepar model, it got the error, I do not know how to fix it, could you help?