Error when checking model input: expected lstm_1_input to have 3 dimensions, but got array with shape (339732, 29)

Setting timesteps = 1 (since, I want one timestep for each instance) and reshaping the X_train and X_test as: import numpy as np X_train = np.reshape(X_train, (X_train.shape[0], 1, X_train.shape[1])) X_test = np.reshape(X_test, (X_test.shape[0], 1, X_test.shape[1])) This worked!

How to set weights in Keras with a numpy array?

What is keras_layer in your code? You can set weights these ways: model.layers[i].set_weights(listOfNumpyArrays) model.get_layer(layerName).set_weights(…) model.set_weights(listOfNumpyArrays) Where model is an instance of an existing model. You can see the expected length of the list and its array shapes using the method get_weights() from the same instances above.

How to change Keras backend (where’s the json file)?

After looking at keras sources (this place): Start up your python-binary and do the following import os print(os.path.expanduser(‘~’)) # >>> C:\\Users\\Sascha’ # will look different for different OS This should be the base-directory Keras will build an folder .keras there where keras.json resides (if it was already created). If it’s not there, create it there … Read more

What is the difference between Keras and tf.keras in TensorFlow 1.1+?

tf.keras (formerly tf.contrib.keras) is an implementation of keras 2 implemented exclusively with/for tensorflow. It is hosted on the tensorflow repo and has a distinct code base than the official repo (the last commit there in the tf-keras branch dates back from May 2017). As a rule of thumb, if your code use any tensorflow-specific code, … Read more

What’s the difference between “samples_per_epoch” and “steps_per_epoch” in fit_generator

When you use fit_generator, the number of samples processed for each epoch is batch_size * steps_per_epochs. From the Keras documentation for fit_generator: https://keras.io/models/sequential/ steps_per_epoch: Total number of steps (batches of samples) to yield from generator before declaring one epoch finished and starting the next epoch. It should typically be equal to the number of unique … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)