python - Modify Keras Output Shape -


i developing feed forward deep neural network uses 3d input 2d output. how can change network architecture reflect this?? have following code:

data_dim = x_train.shape[2] # 7 timesteps = x_train.shape[1] # 30 batch_size = 32  # expected input batch shape: (batch_size, timesteps, data_dim) # note have provide full batch_input_shape since network stateful. # sample of index in batch k follow-up sample in batch k-1.  model = sequential() model.add(dense(64, activation='relu',                  batch_input_shape=(batch_size, timesteps, data_dim))) model.add(dropout(0.2)) model.add(dense(64, activation='relu')) model.add(dropout(0.2)) model.add(dense(64, activation='relu')) model.add(dense(1, activation='linear'))  model.compile(loss='mean_squared_error',               optimizer='rmsprop',               metrics=['accuracy'])  history = model.fit(x_train, y_train,               batch_size=batch_size,                epochs=80,                shuffle=false,               validation_data=(x_test, y_test)) 

and following error

error when checking target: expected dense_84 have 3 dimensions, got array shape (2176, 1)

the model.summary() following:

    layer (type)                 output shape              param #    ================================================================= dense_71 (dense)             (32, 30, 64)              512        _________________________________________________________________ dropout_49 (dropout)         (32, 30, 64)              0          _________________________________________________________________ dense_72 (dense)             (32, 30, 64)              4160       _________________________________________________________________ dropout_50 (dropout)         (32, 30, 64)              0          _________________________________________________________________ dense_73 (dense)             (32, 30, 64)              4160       _________________________________________________________________ dense_74 (dense)             (32, 30, 1)               65         ================================================================= total params: 8,897 trainable params: 8,897 non-trainable params: 0 ___________________________________ 


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

.htaccess - ERR_TOO_MANY_REDIRECTS htaccess -