Making a Basic Keras Model - Input Shape and Parameters - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Data Science (https://python-forum.io/forum-44.html) +--- Thread: Making a Basic Keras Model - Input Shape and Parameters (/thread-29062.html) |
Making a Basic Keras Model - Input Shape and Parameters - MattKahn13 - Aug-16-2020 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: 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: Any help that you guys could provide would be great! I'd be more than happy to clarify anything!Matt |