Skill

Parameters

class agilerl.wrappers.learning.Skill(env: Env)

The Skill class, used in curriculum learning to teach agents skills. This class works as a wrapper around an environment that alters the reward to encourage learning of a particular skill.

Parameters:

env (Gymnasium-style environment) – Environment to learn in

skill_reward(observation: object, reward: SupportsFloat, terminated: bool, truncated: bool, info: dict[str, Any]) tuple[Any, SupportsFloat, bool, bool, dict[str, Any]]

Calculate the reward for the given observation, reward, terminated, truncated, and info.

Parameters:
  • observation (object) – Observation

  • reward (SupportsFloat) – Reward, as returned by the wrapped environment

  • terminated (bool) – Terminated

  • truncated (bool) – Truncated

  • info (dict[str, Any]) – Info

Returns:

Tuple of (observation, reward, terminated, truncated, info)

Return type:

tuple[Any, SupportsFloat, bool, bool, dict[str, Any]]

step(action: object) tuple[Any, SupportsFloat, bool, bool, dict[str, Any]]

Step the environment and return the observation, reward, terminated, truncated, and info.

Parameters:

action (object) – Action

Returns:

Tuple of (observation, reward, terminated, truncated, info)

Return type:

tuple[Any, SupportsFloat, bool, bool, dict[str, Any]]

BanditEnv

Parameters

class agilerl.wrappers.learning.BanditEnv(features: DataFrame, targets: DataFrame)

The Bandit learning environment class. Turns a labelled dataset into a reinforcement learning, Gym-style environment.

Parameters:
  • features (pd.DataFrame) – Dataset features

  • targets (pd.DataFrame) – Dataset targets corresponding to features

reset() ndarray[tuple[int, ...], dtype[_ScalarType_co]]

Reset the environment and return the initial state.

Returns:

Initial state

Return type:

npt.NDArray

step(k: int) tuple[ndarray[tuple[int, ...], dtype[_ScalarType_co]], float]

Step the environment and return the state and reward.

Parameters:

k (int) – Action

Returns:

Tuple of (state, reward)

Return type:

tuple[npt.NDArray, float]