I'm want to build DQNAgent but I have a problem whit the data or with the NN(I'm not sure). I tried to solve it by changing the shape of the array but I'm always getting the same error:ValueError: setting an array element with a sequence.
This is the data:
state(array,shape:(2,2)):
[4499.74073719, 121.58564876],
[4669.91329184, 42.37631835]])
array([[-2000. , 290.01270128]])]
[array([[-4370., 800.],
[ -635., 800.]]) -12.0]]
Label(Q value):
array([0.23,1,3,0.1234])
The programe need to prodict the q_value baice on the data. This is the code:
model=Sequential()
model.add(Flatten(input_shape=(2,2)))
model.add(Dense(24, activation='relu'))
model.add(Dense(24, activation='relu'))
model.add(Dense(acton_size, activation='linear'))
model.compile(loss='mse',optimizer=Adam(lr=learning_rate))
return model
r_locs, i_locs, c_locs, ang, score=Game_step(random.randint(0,4))
state=np.array([r_locs, i_locs, c_locs, ang])
state=np.reshape(state,[2,2])
ERROR:
return array(a, dtype, copy=False, order=order)
ValueError: setting an array element with a sequence.
Any idea how to solve this? THANKS😁
Not entirely sure about this, but it may be that the state matrix you are trying to process through the network is not being interpreted as you expect. I believe, the network is expecting each sample to be a 2x2 matrix of numbers, and your state is a combination of numbers and arrays from what it appears. This might point you in the right direction. I hope it helps.