velora.metrics¶
Documentation
Classes and methods dedicated to offline metric storage.
Episode
¶
Bases: SQLModel
Episode-level metrics tracking reward, length, and agent performance.
Attributes:
Name | Type | Description |
---|---|---|
id |
int
|
a unique identifier for the episode |
experiment_id |
int
|
the experiment ID associated to the episode |
episode_num |
int
|
the episode index |
reward |
float
|
the episodic reward (return) |
length |
int
|
the number of timesteps performed to terminate the episode |
reward_moving_avg |
float
|
the episodes reward moving average based on a window size |
reward_moving_std |
float
|
the episodes reward moving standard deviation based on a window size |
actor_loss |
float
|
the average Actor loss for the episode |
critic_loss |
float
|
the average Critic loss for the episode |
entropy_loss |
float
|
the average Entropy loss for the episode |
created_at |
datetime
|
the date and time when the the entry was created |
Source code in velora/metrics/models.py
Python | |
---|---|
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
|
Experiment
¶
Bases: SQLModel
Experiment information tracking agent, environment, and metadata.
Attributes:
Name | Type | Description |
---|---|---|
id |
int
|
unique identifier for the experiment |
agent |
str
|
the name of the agent used in the experiment |
env |
str
|
the name of the environment used in the experiment |
config |
str
|
a JSON string containing the agent's configuration details |
created_at |
datetime
|
the date and time the experiment was created |
Source code in velora/metrics/models.py
Python | |
---|---|
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
|
get_current_episode(session, experiment_id, current_ep)
¶
Queries a database session to retrieve the current episode for an experiment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
sqlmodel.Session
|
a metric database session |
required |
experiment_id
|
int
|
the current experiment's unique ID |
required |
current_ep
|
int
|
the current episode index |
required |
Returns:
Name | Type | Description |
---|---|---|
results |
ScalarResult[Episode]
|
a iterable set of matching episodes. |
Source code in velora/metrics/db.py
Python | |
---|---|
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
get_db_engine()
¶
Starts the metric database engine and returns it.
Returns:
Name | Type | Description |
---|---|---|
engine |
sqlalchemy.Engine
|
a database engine instance |
Source code in velora/metrics/db.py
Python | |
---|---|
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
|