csle_agents.agents.dqn_clean package

Submodules

csle_agents.agents.dqn_clean.dqn_clean_agent module

MIT License

Copyright (c) 2019 CleanRL developers https://github.com/vwxyzjn/cleanrl

class csle_agents.agents.dqn_clean.dqn_clean_agent.DQNCleanAgent(simulation_env_config: csle_common.dao.simulation_config.simulation_env_config.SimulationEnvConfig, emulation_env_config: Optional[csle_common.dao.emulation_config.emulation_env_config.EmulationEnvConfig], experiment_config: csle_common.dao.training.experiment_config.ExperimentConfig, training_job: Optional[csle_common.dao.jobs.training_job_config.TrainingJobConfig] = None, save_to_metastore: bool = True)[source]

Bases: csle_agents.agents.base.base_agent.BaseAgent

A DQN agent using the implementation from OpenAI baselines

hparam_names() List[str][source]

Gets the hyperparameters

Returns

a list with the hyperparameter names

linear_schedule(duration: int, t: int) float[source]

Linear exploration rate decay sechdule

Parameters
  • duration – the duration of training

  • t – the current time

Returns

the new exploration rate

make_env() Callable[[], gymnasium.wrappers.record_episode_statistics.RecordEpisodeStatistics][source]

Helper function for creating an environment in training of the agent

Returns

environment creating function

run_dqn(exp_result: csle_common.dao.training.experiment_result.ExperimentResult, seed: int) Tuple[csle_common.dao.training.experiment_result.ExperimentResult, csle_common.dao.simulation_config.base_env.BaseEnv, csle_common.models.q_network.QNetwork][source]

Runs DQN with given seed

Parameters
  • exp_result – the object to save the experiment results

  • seed – the random seed

Retur

the updated experiment results, the environment and the trained model

train() csle_common.dao.training.experiment_execution.ExperimentExecution[source]

Implements the training logic of the DQN algorithm

Returns

the experiment result

Module contents