The DQN class.
More...
|
| def | __init__ (self, int number_of_actions, int state_size, network_path="") |
| | The RobotNetwork class initializer. More...
|
| |
| def | save (self, str path) |
| | Save the network to a given path. More...
|
| |
| def | update (self, np.ndarray state, np.ndarray next_state, int action, float reward, bool finished) |
| | Update the network, should happen between each state transition during training. More...
|
| |
| int | get_best_action (self, np.ndarray state) |
| | Look up the best action for a given state. More...
|
| |
|
|
| eps |
| |
|
| gamma |
| |
|
| eps_end |
| |
|
| eps_decay |
| |
|
| batch_size |
| |
|
| mem_size |
| |
|
| hidden_nodes |
| |
|
| network |
| |
|
| optimizer |
| |
|
| memory |
| |
The DQN class.
Defines the class that will represent the Deep Q-Network.
◆ __init__()
| def rl.dqn.DQN.__init__ |
( |
|
self, |
|
|
int |
number_of_actions, |
|
|
int |
state_size, |
|
|
|
network_path = "" |
|
) |
| |
The RobotNetwork class initializer.
- Parameters
-
| number_of_actions | The number of hidden nodes for the hidden layers. |
| state_size | The number of variables in a state, important for the nodes needed as input. |
| network_path | The path to the file that contains a (trained) network. |
- Returns
- An instance of the DQN class.
◆ get_best_action()
| int rl.dqn.DQN.get_best_action |
( |
|
self, |
|
|
np.ndarray |
state |
|
) |
| |
Look up the best action for a given state.
- Parameters
-
| state | An input state representing the environment. |
- Returns
- An action, represented as a number.
◆ save()
| def rl.dqn.DQN.save |
( |
|
self, |
|
|
str |
path |
|
) |
| |
Save the network to a given path.
- Parameters
-
| path | The file path to save the network to. |
◆ update()
| def rl.dqn.DQN.update |
( |
|
self, |
|
|
np.ndarray |
state, |
|
|
np.ndarray |
next_state, |
|
|
int |
action, |
|
|
float |
reward, |
|
|
bool |
finished |
|
) |
| |
Update the network, should happen between each state transition during training.
- Parameters
-
| state | The start state of the environment. |
| next_state | The resulting, next state after executing an action. |
| action | The action that was executed. |
| reward | The reward resulting from the action. |
| finished | If the next_state is a finishing state. |
The documentation for this class was generated from the following file: