duo_ai.algorithms.always¶
Classes¶
Configuration for the AlwaysAlgorithm, which always returns the same action. |
|
Algorithm that always returns the same action, regardless of input. |
Module Contents¶
- class duo_ai.algorithms.always.AlwaysAlgorithmConfig[source]¶
Configuration for the AlwaysAlgorithm, which always returns the same action.
- Parameters:
name (str, optional) – Name of the algorithm class. Default is “always”.
Examples
>>> config = AlwaysAlgorithmConfig()
- name: str = 'always'¶
- class duo_ai.algorithms.always.AlwaysAlgorithm(config: AlwaysAlgorithmConfig)[source]¶
Bases:
duo_ai.core.algorithm.AlgorithmAlgorithm that always returns the same action, regardless of input.
Examples
>>> algo = AlwaysAlgorithm(AlwaysAlgorithmConfig())
- config_cls¶
- train(policy: duo.core.Policy, env: gym.Env, validators: Dict[str, duo.core.Evaluator]) None[source]¶
Run the AlwaysAlgorithm training procedure.
This method evaluates the provided policy in the given environment using the specified evaluators. The AlwaysAlgorithm always returns the same action, regardless of the input observation.
- Parameters:
policy (duo.core.Policy) – The policy instance to use for generating actions.
env (gym.Env) – The environment in which the policy is evaluated.
validators (dict of str to duo.core.Evaluator) – Dictionary mapping split names to evaluator instances for evaluation.
- Return type:
None
Examples
>>> algorithm = AlwaysAlgorithm(AlwaysAlgorithmConfig()) >>> algorithm.train(policy, env, validators)