pub struct IncrementalLinearRegression { /* private fields */ }Implementations§
Source§impl IncrementalLinearRegression
impl IncrementalLinearRegression
Sourcepub fn new(schedule: LearningRateSchedule, l2_penalty: f64) -> Self
pub fn new(schedule: LearningRateSchedule, l2_penalty: f64) -> Self
Examples found in repository?
examples/batch_vs_incremental_comparison.rs (line 25)
7fn main() {
8 println!("===Batch vs. Incremental Convergence Comparison ===");
9
10 let x = Array2::from_shape_vec(
11 (8, 2),
12 vec![
13 1.0, 2.0, 2.0, 1.0, 3.0, 4.0, 5.0, 2.0, 4.0, 1.0, 6.0, 3.0, 7.0, 2.0, 8.0, 5.0,
14 ],
15 )
16 .unwrap();
17 let y = array![-3.5, 1.5, -5.5, 4.5, 5.5, 3.5, 8.5, 1.5];
18
19 let schedule = LearningRateSchedule::InverseScaling {
20 initial_rate: 0.05,
21 decay: 0.01,
22 power: 0.5,
23 };
24
25 let mut model = IncrementalLinearRegression::new(schedule, 0.01);
26
27 println!("Step | Mini-Batch MSE Loss");
28 println!("--------------------------");
29
30 let mut monitored = MonitoredEstimator::new(&mut model, |stats: BatchStats| {
31 println!("{:4} | {:.6}", stats.step, stats.loss);
32 });
33
34 // Run multiple incremental epoch passes over data[cite: 1]
35 for _ in 0..10 {
36 monitored.partial_fit(&x, &y).unwrap();
37 }
38}Trait Implementations§
Source§impl Debug for IncrementalLinearRegression
impl Debug for IncrementalLinearRegression
Auto Trait Implementations§
impl Freeze for IncrementalLinearRegression
impl RefUnwindSafe for IncrementalLinearRegression
impl Send for IncrementalLinearRegression
impl Sync for IncrementalLinearRegression
impl Unpin for IncrementalLinearRegression
impl UnsafeUnpin for IncrementalLinearRegression
impl UnwindSafe for IncrementalLinearRegression
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