the below code is not working and showing error, make the below code working PS…
- User
the below code is not working and showing error, make the below code working PS E:\drone_rl> & C:/Users/dkuch/AppData/Local/Microsoft/WindowsApps/python3.10.exe e:/drone_rl/3_test.py Traceback (most recent call last): File "e:\drone_rl\3_test.py", line 47, in action_1 = np.argmax(Q1[state_1, state_2]) IndexError: index 11 is out of bounds for axis 1 with size 4
- Assistant
It's not possible to debug the code without seeing the whole code. However, the error suggests that you are trying to access an index that doesn't exist in the second axis of the array
Q1. The error is happening when you're trying to get the maximum index along axis 1 (columns) of theQ1[state_1, state_2]expression.To fix this error, ensure that the values of
state_1andstate_2are within the correct bounds for the dimensions of the arrayQ1. If possible, please provide the full code, or at least share the dimensions of theQ1array and howstate_1andstate_2are being computed. - User
please tell me how to run this https://github.com/higgsfield/RL-Adventure-2/blob/master/5.ddpg.ipynb
- Assistant
To run the DDPG agent provided in the Jupyter Notebook from the GitHub repository you shared, follow these steps:
- Clone the repository:
codegit clone https://github.com/higgsfield/RL-Adventure-2.git- Change the current directory to the cloned repository:
codecd RL-Adventure-2- Install a virtual environment package (if not already installed):
codepip install virtualenv- Create a virtual environment in your project folder:
codevirtualenv venv- Activate the virtual environment: