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: Any, reward: float, terminated: bool, truncated: bool, info: dict[str, Any]) tuple[Any, float, bool, bool, dict[str, Any]]

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

Parameters:
  • observation (Any) – Observation

  • reward (float) – Reward

  • terminated (bool) – Terminated

  • truncated (bool) – Truncated

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

Returns:

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

Return type:

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

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

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

Parameters:

action (Any) – Action

Returns:

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

Return type:

tuple[Any, float, 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

Reset the environment and return the initial state.

Returns:

Initial state

Return type:

np.ndarray

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

Step the environment and return the state and reward.

Parameters:

k (int) – Action

Returns:

Tuple of (state, reward)

Return type:

tuple[np.ndarray, float]