Skip to content

comet_ml.integration.gymnasium ¶

CometLogger ¶

CometLogger(env: gym.Env, experiment: comet_ml.Experiment)

Gymnasium Wrapper that logs the step length and cumulative reward for an episode to Comet

Parameters:

  • env (Env) –

    Gymnasium environment to wrap

  • experiment (Experiment) –

    The Comet Experiment object to use for experiment management

episode_counter property ¶

episode_counter

Returns the number of episodes that have passed. Incremented when .reset() is called

step_counter property ¶

step_counter

Returns the number of times .step() has been called

close ¶

close()

Cleans up the environment after the user has finished using it.

If the original environment wrapped by this object was also wrapped by a RecordVideo wrapper, this method will log the video files to Comet.

reset ¶

reset(**kwargs)

Resets length and reward counters and increments episode counter. Any arguments specified in kwargs are passed to Gymnasium enviroment as usual.

step ¶

step(action)

Steps through the environment using given action. Episode reward, length and step counter are tracked.

Parameters:

  • action (ActType) –

    An action provided by the agent to update the environment state.

Jul. 25, 2024