Expand description
Types and traits for recording and managing training metrics.
This module provides a comprehensive system for recording, storing, and managing various types of data during reinforcement learning training and evaluation. It includes support for different data types, aggregation, and flexible storage backends.
§Core Components
Record
- A flexible container for storing key-value pairs of various data typesRecordValue
- An enum representing different types of values that can be storedRecorder
- A trait defining the interface for recording and storing dataRecordStorage
- A storage system with aggregation capabilitiesBufferedRecorder
- A recorder that temporarily stores records in memoryNullRecorder
- A recorder that discards all records (useful for testing)
§Basic Usage
use border_core::record::{Record, RecordValue};
// following values are obtained with some process in reality
let step = 1;
let obs = vec![1f32, 2.0, 3.0, 4.0, 5.0];
let reward = -1f32;
let mut record = Record::empty();
record.insert("Step", RecordValue::Scalar(step as f32));
record.insert("Reward", RecordValue::Scalar(reward));
record.insert("Obs", RecordValue::Array1(obs));
§Integration with Training
The recording system is designed to work seamlessly with the training process.
The Trainer
uses a Recorder
to log training metrics
and other relevant information during the training loop.
§Data Types
The module supports various data types through RecordValue
:
Scalar(f32)
- Single floating-point valuesDateTime(DateTime<Local>)
- TimestampsArray1(Vec<f32>)
- 1-dimensional arraysArray2(Vec<f32>, [usize; 2])
- 2-dimensional arrays with shapeArray3(Vec<f32>, [usize; 3])
- 3-dimensional arrays with shapeString(String)
- Text values
Structs§
- Buffered
Recorder - A recorder that buffers sequences of observations and actions in memory.
- Null
Recorder - A recorder that discards all records without storing them.
- Record
- A container for storing key-value pairs of various data types.
- Record
Storage - A storage system for records with aggregation capabilities.
Enums§
- Record
Value - Represents possible types of values that can be stored in a
Record
.
Traits§
- Recorder
- A trait for recording training metrics and managing model persistence.