pub struct TimeSeriesOde {
pub times: Vec<f64>,
pub observations: Vec<Vec<f64>>,
pub solver: NeuralOdeSolver,
pub learning_rate: f64,
pub n_iter: usize,
pub loss_history: Vec<f64>,
}Expand description
A convenience wrapper that fits a Neural ODE to observed time-series data using gradient descent on the MSE loss.
Fields§
§times: Vec<f64>Observed time points (sorted ascending).
observations: Vec<Vec<f64>>Corresponding observations, one per time point.
solver: NeuralOdeSolverThe underlying Neural ODE solver.
learning_rate: f64Learning rate for gradient descent.
n_iter: usizeNumber of fitting iterations.
loss_history: Vec<f64>MSE loss history across iterations.
Implementations§
Source§impl TimeSeriesOde
impl TimeSeriesOde
Sourcepub fn new(
times: Vec<f64>,
observations: Vec<Vec<f64>>,
solver: NeuralOdeSolver,
learning_rate: f64,
n_iter: usize,
) -> Self
pub fn new( times: Vec<f64>, observations: Vec<Vec<f64>>, solver: NeuralOdeSolver, learning_rate: f64, n_iter: usize, ) -> Self
Construct a TimeSeriesOde from observed data and an initial solver.
Sourcepub fn fit(&mut self)
pub fn fit(&mut self)
Run gradient descent to fit the Neural ODE parameters to the observations.
Uses finite-difference parameter gradients (one perturbation per weight). This is intentionally simple — a production implementation would use the adjoint method for efficiency.
Sourcepub fn compute_loss(&self, dt: f64) -> f64
pub fn compute_loss(&self, dt: f64) -> f64
Compute MSE between predicted trajectory and observations.
Trait Implementations§
Source§impl Clone for TimeSeriesOde
impl Clone for TimeSeriesOde
Source§fn clone(&self) -> TimeSeriesOde
fn clone(&self) -> TimeSeriesOde
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 moreAuto Trait Implementations§
impl Freeze for TimeSeriesOde
impl RefUnwindSafe for TimeSeriesOde
impl Send for TimeSeriesOde
impl Sync for TimeSeriesOde
impl Unpin for TimeSeriesOde
impl UnsafeUnpin for TimeSeriesOde
impl UnwindSafe for TimeSeriesOde
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§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 moreSource§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).Source§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.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.