Struct argmin_observer_paramwriter::ParamWriter
source · pub struct ParamWriter { /* private fields */ }
Expand description
Write parameter vectors to a file during optimization.
This observer requires a directory to save the files to and a file prefix. Files will be
written to disk as <directory>/<file_prefix>_<iteration_number>.<extension>
. For
serialization either JSON
or Binary
(via bincode)
can be chosen via the enum ParamWriterFormat
.
§Example
Create an observer for saving the parameter vector into a JSON file.
use argmin_observer_paramwriter::{ParamWriter, ParamWriterFormat};
let observer = ParamWriter::new("directory", "file_prefix", ParamWriterFormat::JSON);
Create an observer for saving the parameter vector into a binary file using
bincode
.
use argmin_observer_paramwriter::{ParamWriter, ParamWriterFormat};
let observer = ParamWriter::new("directory", "file_prefix", ParamWriterFormat::Binary);
Implementations§
source§impl ParamWriter
impl ParamWriter
Trait Implementations§
source§impl Clone for ParamWriter
impl Clone for ParamWriter
source§fn clone(&self) -> ParamWriter
fn clone(&self) -> ParamWriter
Returns a copy of the value. Read more
1.0.0 · 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 ParamWriter
impl Debug for ParamWriter
source§impl<I> Observe<I> for ParamWriter
impl<I> Observe<I> for ParamWriter
ParamWriter
only implements observer_iter
and not observe_init
to avoid saving the
initial parameter vector. It will only save if there is a parameter vector available in the
state, otherwise it will skip saving silently.
source§impl PartialEq for ParamWriter
impl PartialEq for ParamWriter
impl Eq for ParamWriter
impl StructuralPartialEq for ParamWriter
Auto Trait Implementations§
impl Freeze for ParamWriter
impl RefUnwindSafe for ParamWriter
impl Send for ParamWriter
impl Sync for ParamWriter
impl Unpin for ParamWriter
impl UnwindSafe for ParamWriter
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.