Struct PerConfig Copy item path Source pub struct PerConfig {
pub alpha: f32 ,
pub beta_0: f32 ,
pub beta_final: f32 ,
pub n_opts_final: usize ,
pub normalize: WeightNormalizer ,
}
Expand description Configuration for Prioritized Experience Replay (PER).
This structure defines the parameters for prioritized sampling in the replay buffer.
It controls how transitions are sampled based on their importance and how
importance weights are calculated and normalized.
§ Fields
alpha
- Controls the degree of prioritization (0 = uniform sampling)
beta_0
- Initial value for importance sampling weights
beta_final
- Final value for importance sampling weights
n_opts_final
- Number of optimization steps to reach beta_final
normalize
- Method for normalizing importance weights
§ Examples
use border_core::generic_replay_buffer::{PerConfig, WeightNormalizer};
let config = PerConfig::default()
.alpha(0.6 )
.beta_0(0.4 )
.beta_final(1.0 )
.n_opts_final(500_000 )
.normalize(WeightNormalizer::All);
Exponent for prioritization. Higher values increase the bias towards
high-priority transitions. A value of 0 results in uniform sampling.
Initial value of the importance sampling exponent. Lower values reduce
the impact of importance sampling weights.
Final value of the importance sampling exponent. Typically set to 1.0
to fully compensate for the non-uniform sampling.
Number of optimization steps after which beta
reaches its final value.
This allows for a gradual increase in the impact of importance sampling.
Method for normalizing importance sampling weights. Controls how the
weights are scaled to prevent numerical instability.
Sets the prioritization exponent alpha
.
§ Arguments
alpha
- The new value for the prioritization exponent
§ Returns
The modified configuration
Sets the initial importance sampling exponent beta_0
.
§ Arguments
beta_0
- The new initial value for the importance sampling exponent
§ Returns
The modified configuration
Sets the final importance sampling exponent beta_final
.
§ Arguments
beta_final
- The new final value for the importance sampling exponent
§ Returns
The modified configuration
Sets the number of optimization steps to reach the final beta value.
§ Arguments
n_opts_final
- The new number of optimization steps
§ Returns
The modified configuration
Sets the method for normalizing importance weights.
§ Arguments
normalize
- The new normalization method
§ Returns
The modified configuration
Performs copy-assignment from
source
.
Read more Formats the value using the given formatter.
Read more Creates a default PER configuration with commonly used values:
alpha = 0.6
(moderate prioritization)
beta_0 = 0.4
(initial importance sampling)
beta_final = 1.0
(full compensation)
n_opts_final = 500_000
(gradual increase)
normalize = All
(normalize all weights)
Deserialize this value from the given Serde deserializer.
Read more Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
Serialize this value into the given Serde serializer.
Read more Immutably borrows from an owned value.
Read more Mutably borrows from an owned value.
Read more 🔬 This is a nightly-only experimental API. (clone_to_uninit
)
Performs copy-assignment from
self
to
dest
.
Read more Returns the argument unchanged.
Calls U::from(self)
.
That is, this conversion is whatever the implementation of
From <T> for U
chooses to do.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more Uses borrowed data to replace owned data, usually by cloning.
Read more The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.