pub struct WriteToFile { /* 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>.arp
. For serialization
either JSON
or bincode
can be chosen via the enum
WriteToFileSerializer
.
This feature requires the serde1
feature to be set.
Example
Create an observer for saving the parameter vector into a JSON file.
use argmin::core::observers::{WriteToFile, WriteToFileSerializer};
let observer = WriteToFile::new("directory", "file_prefix", WriteToFileSerializer::JSON);
Create an observer for saving the parameter vector into a binary file using
bincode
.
use argmin::core::observers::{WriteToFile, WriteToFileSerializer};
let observer = WriteToFile::new("directory", "file_prefix", WriteToFileSerializer::Bincode);
Implementations
sourceimpl WriteToFile
impl WriteToFile
Trait Implementations
sourceimpl Clone for WriteToFile
impl Clone for WriteToFile
sourcefn clone(&self) -> WriteToFile
fn clone(&self) -> WriteToFile
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for WriteToFile
impl Debug for WriteToFile
sourceimpl<I> Observe<I> for WriteToFile where
I: State,
<I as State>::Param: Serialize,
impl<I> Observe<I> for WriteToFile where
I: State,
<I as State>::Param: Serialize,
WriteToFile
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.
sourceimpl PartialEq<WriteToFile> for WriteToFile
impl PartialEq<WriteToFile> for WriteToFile
sourcefn eq(&self, other: &WriteToFile) -> bool
fn eq(&self, other: &WriteToFile) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
impl Eq for WriteToFile
impl StructuralEq for WriteToFile
impl StructuralPartialEq for WriteToFile
Auto Trait Implementations
impl RefUnwindSafe for WriteToFile
impl Send for WriteToFile
impl Sync for WriteToFile
impl Unpin for WriteToFile
impl UnwindSafe for WriteToFile
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more