Aug-16-2020, 04:36 PM
Hey Guys!
I am currently trying to build a simple model which I plan to use to make predictions. The idea for this model is to have each of the 202-dimensional vectors in an array (300 in total) be fitted (using model.fit) to a 1 dimensional vector containing a single integer (also 300 in total). Currently, I have two numpy arrays with the following dimensions: [300,202] and [300,]. I am really having difficulty constructing this model. Here is the current code that I have:
Matt
I am currently trying to build a simple model which I plan to use to make predictions. The idea for this model is to have each of the 202-dimensional vectors in an array (300 in total) be fitted (using model.fit) to a 1 dimensional vector containing a single integer (also 300 in total). Currently, I have two numpy arrays with the following dimensions: [300,202] and [300,]. I am really having difficulty constructing this model. Here is the current code that I have:
model = tf.keras.Sequential() model.add(tf.keras.layers.Flatten(input_shape=(202,))) model.add(tf.keras.layers.Dense(128, activation="relu")) model.add(tf.keras.layers.Dense(1)) model.compile(loss = "mean_squared_error", optimizer=tf.keras.optimizers.Adam(0.1)) print(model.summary()) #"states" has shape [300,202] and "actions" has shape[300,] history = model.fit(states, actions, epochs = 1, verbose=False) print("Finished") print(model.predict([states[0]]))Here is the error message that I keep getting:
Error:"ValueError: Error when checking input: expected input_1 to have shape (202,) but got array with shape (1,)"
Any help that you guys could provide would be great! I'd be more than happy to clarify anything!Matt