agentMET4FOF
agentMET4FOF copied to clipboard
running keras model in agent shows error
class Trainer(AgentMET4FOF):
def init_parameters(self):
r = random.randrange(10, 20)
a = {'x': [1, 2, 3], 'y': r}
# print(a['x'])
a = pd.DataFrame(a['x'])
#print(a.shape)
a = np.array(a)
#print(a.shape)
X_train = a.reshape(a.shape[0], 1, a.shape[1])
print(np.shape(X_train))
inputs = Input(shape=(X_train.shape[1], X_train.shape[2]))
L1 = LSTM(16, activation='relu', return_sequences=True,
kernel_regularizer=regularizers.l2(0.00))(inputs)
output = TimeDistributed(Dense(X_train.shape[2]))(L1)
model = Model(inputs=inputs, outputs=output)
model.compile(optimizer='adam', loss='mse')
model.fit(X_train, X_train, epochs=5, batch_size=32)
model.predict(X_train)
#56 AttributeError: '_thread._local' object has no attribute 'value'