Struct Learner
pub struct Learner {
pub weights: [f64; 5],
pub epoch: u64,
pub draws: u64,
pub shortfall: f64,
}Expand description
A training run’s state: what a checkpoint holds.
Fields§
§weights: [f64; 5]The policy’s weights.
epoch: u64Completed epochs.
draws: u64How many training draws have been taken from TRAIN_SEED: the
generator’s position.
shortfall: f64The sum of the completed epochs’ shortfalls (environment::evaluate).
Implementations§
§impl Learner
impl Learner
pub const fn new() -> Self
pub const fn new() -> Self
A fresh run at INITIAL_WEIGHTS.
pub fn value(&self) -> f64
pub fn value(&self) -> f64
The value to report: the mean shortfall over the completed epochs, or the current policy’s shortfall before the first.
pub fn train_epoch(&mut self, hyper: Hyper) -> f64
pub fn train_epoch(&mut self, hyper: Hyper) -> f64
One epoch: ITERATIONS ARS iterations at hyper, then the
evaluation. Returns the run’s value so far (Self::value).
pub fn checkpoint(&self) -> String
pub fn checkpoint(&self) -> String
The checkpoint text: ars2, the epoch, the draw position, the
shortfall sum’s bits and each weight’s bits, in hexadecimal and
separated by :, so a restored run continues bit for bit.
pub fn from_checkpoint(text: &str) -> Option<Self>
pub fn from_checkpoint(text: &str) -> Option<Self>
Parses Self::checkpoint; None for any other text, a non-finite
weight, a shortfall sum outside [0, 500 × epoch] (each epoch’s
shortfall is in [0, 500]), an epoch beyond 2³², or a draw position
that is not the epoch’s.
Trait Implementations§
impl Copy for Learner
impl StructuralPartialEq for Learner
Auto Trait Implementations§
impl Freeze for Learner
impl RefUnwindSafe for Learner
impl Send for Learner
impl Sync for Learner
impl Unpin for Learner
impl UnsafeUnpin for Learner
impl UnwindSafe for Learner
Blanket Implementations§
impl<T> Boilerplate for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T, U> Imply<T> for U
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
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> ⓘ
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