Note: I have seen this related post but I don't know I can use the answer for my problem.
I try to use Keras for a simple regression. For this I have created a simple policy_network()
function, which returns me the model.
def policy_network():
model = Sequential()
model.add(MaxPooling2D(pool_size=(4, 4),input_shape=[64,64,3]))
model.add(Flatten())
model.add(Dense(1, kernel_initializer='normal', activation='linear'))
model.compile(loss='mean_squared_error',
optimizer=Adam(lr=learning_rate),
metrics=['mean_squared_error'])
return model
I also have defined a global variable policy_network
. I use the following assignment
policy_network = policy_network().fit(images, actions,
batch_size=256,
epochs=10,
shuffle=True)
but when I call
action = policy_network.predict(image)
I get the AttributeError: 'History' object has no attribute 'predict'