pub struct TrainingStats {
pub policy_loss: f64,
pub value_loss: f64,
pub entropy: f64,
pub total_loss: f64,
pub aux_loss: f64,
pub clip_fraction: f64,
pub approx_kl: f64,
pub explained_var: f64,
pub num_updates: usize,
}Expand description
Training statistics for a PPO update
Tracks various metrics from a single training step including losses, KL divergence, and other diagnostic information.
Fields§
§policy_loss: f64Policy loss
value_loss: f64Value function loss
entropy: f64Entropy bonus
total_loss: f64Total loss (weighted sum of policy, value, entropy, and aux losses)
aux_loss: f64Auxiliary loss (caller-supplied — e.g. representation regularizer)
clip_fraction: f64Fraction of clipped policy updates
approx_kl: f64Approximate KL divergence between old and new policies
explained_var: f64Explained variance of value function predictions
num_updates: usizeNumber of gradient updates performed
Implementations§
Source§impl TrainingStats
impl TrainingStats
Sourcepub fn new(
policy_loss: f64,
value_loss: f64,
entropy: f64,
total_loss: f64,
clip_fraction: f64,
approx_kl: f64,
explained_var: f64,
) -> Self
pub fn new( policy_loss: f64, value_loss: f64, entropy: f64, total_loss: f64, clip_fraction: f64, approx_kl: f64, explained_var: f64, ) -> Self
Create statistics from scalar values.
aux_loss defaults to 0.0; set with Self::with_aux_loss when an
auxiliary loss term is present.
Sourcepub fn with_aux_loss(self, aux_loss: f64) -> Self
pub fn with_aux_loss(self, aux_loss: f64) -> Self
Builder-style setter for the auxiliary loss field.
Sourcepub fn add(&mut self, other: &TrainingStats)
pub fn add(&mut self, other: &TrainingStats)
Add another statistics instance to this one
Trait Implementations§
Source§impl AddAssign<&TrainingStats> for TrainingStats
impl AddAssign<&TrainingStats> for TrainingStats
Source§fn add_assign(&mut self, other: &TrainingStats)
fn add_assign(&mut self, other: &TrainingStats)
Performs the
+= operation. Read moreSource§impl Clone for TrainingStats
impl Clone for TrainingStats
Source§fn clone(&self) -> TrainingStats
fn clone(&self) -> TrainingStats
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TrainingStats
impl Debug for TrainingStats
Source§impl Default for TrainingStats
impl Default for TrainingStats
Source§fn default() -> TrainingStats
fn default() -> TrainingStats
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TrainingStats
impl RefUnwindSafe for TrainingStats
impl Send for TrainingStats
impl Sync for TrainingStats
impl Unpin for TrainingStats
impl UnsafeUnpin for TrainingStats
impl UnwindSafe for TrainingStats
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more