@@ -91,7 +91,7 @@ pub struct OnlineLoessBuilder<T: FloatLinalg + DistanceLinalg + SolverLinalg> {
9191 pub iterations : usize ,
9292
9393 /// Convergence tolerance for early stopping (None = disabled)
94- pub auto_convergence : Option < T > ,
94+ pub auto_converge : Option < T > ,
9595
9696 /// Kernel weight function
9797 pub weight_function : WeightFunction ,
@@ -205,7 +205,7 @@ impl<T: FloatLinalg + DistanceLinalg + Debug + Send + Sync + SolverLinalg> Onlin
205205 boundary_policy : BoundaryPolicy :: default ( ) ,
206206 compute_residuals : false ,
207207 return_robustness_weights : false ,
208- auto_convergence : None ,
208+ auto_converge : None ,
209209 deferred_error : None ,
210210 polynomial_degree : PolynomialDegree :: default ( ) ,
211211 dimensions : 1 ,
@@ -319,7 +319,7 @@ impl<T: FloatLinalg + DistanceLinalg + Debug + Send + Sync + SolverLinalg> Onlin
319319
320320 /// Enable auto-convergence for robustness iterations.
321321 pub fn auto_converge ( mut self , tolerance : T ) -> Self {
322- self . auto_convergence = Some ( tolerance) ;
322+ self . auto_converge = Some ( tolerance) ;
323323 self
324324 }
325325
@@ -455,6 +455,9 @@ pub struct OnlineOutput<T> {
455455
456456 /// Robustness weight for the latest point (if computed)
457457 pub robustness_weight : Option < T > ,
458+
459+ /// Number of robustness iterations actually performed
460+ pub iterations_used : Option < usize > ,
458461}
459462
460463// ============================================================================
@@ -541,13 +544,14 @@ impl<T: FloatLinalg + DistanceLinalg + Debug + Send + Sync + 'static + SolverLin
541544 std_error : None ,
542545 residual : Some ( residual) ,
543546 robustness_weight : Some ( T :: one ( ) ) ,
547+ iterations_used : Some ( 0 ) ,
544548 } ) ) ;
545549 }
546550
547551 // Smooth using LOESS for windows of size >= 3
548552
549553 // Choose update strategy based on configuration
550- let ( smoothed, std_err, rob_weight) = match self . config . update_mode {
554+ let ( smoothed, std_err, rob_weight, iterations ) = match self . config . update_mode {
551555 UpdateMode :: Incremental => {
552556 // Incremental mode: single-pass fit (no robustness) for maximum performance.
553557 let n = x_vec. len ( ) / self . config . dimensions ;
@@ -572,13 +576,13 @@ impl<T: FloatLinalg + DistanceLinalg + Debug + Send + Sync + 'static + SolverLin
572576 iterations : 0 , // No robustness for incremental mode (speed)
573577 weight_function : self . config . weight_function ,
574578 robustness_method : self . config . robustness_method ,
575- scaling_method : self . config . scaling_method , // ADDED
579+ scaling_method : self . config . scaling_method ,
576580 zero_weight_fallback : self . config . zero_weight_fallback ,
577581 boundary_policy : self . config . boundary_policy ,
578582 polynomial_degree : self . config . polynomial_degree ,
579583 dimensions : self . config . dimensions ,
580584 distance_metric : self . config . distance_metric . clone ( ) ,
581- auto_convergence : None ,
585+ auto_converge : None ,
582586 cv_fractions : None ,
583587 cv_kind : None ,
584588 return_variance : None ,
@@ -605,7 +609,7 @@ impl<T: FloatLinalg + DistanceLinalg + Debug + Send + Sync + 'static + SolverLin
605609 LoessError :: InvalidNumericValue ( "No smoothed output produced" . into ( ) )
606610 } ) ?;
607611
608- ( smoothed_val, None , Some ( T :: one ( ) ) )
612+ ( smoothed_val, None , Some ( T :: one ( ) ) , result . iterations )
609613 }
610614 UpdateMode :: Full => {
611615 // Validate grid resolution
@@ -632,13 +636,13 @@ impl<T: FloatLinalg + DistanceLinalg + Debug + Send + Sync + 'static + SolverLin
632636 iterations : self . config . iterations ,
633637 weight_function : self . config . weight_function ,
634638 robustness_method : self . config . robustness_method ,
635- scaling_method : self . config . scaling_method , // ADDED
639+ scaling_method : self . config . scaling_method ,
636640 zero_weight_fallback : self . config . zero_weight_fallback ,
637641 boundary_policy : self . config . boundary_policy ,
638642 polynomial_degree : self . config . polynomial_degree ,
639643 dimensions : self . config . dimensions ,
640644 distance_metric : self . config . distance_metric . clone ( ) ,
641- auto_convergence : self . config . auto_convergence ,
645+ auto_converge : self . config . auto_converge ,
642646 cv_fractions : None ,
643647 cv_kind : None ,
644648 return_variance : None ,
@@ -674,7 +678,7 @@ impl<T: FloatLinalg + DistanceLinalg + Debug + Send + Sync + 'static + SolverLin
674678 None
675679 } ;
676680
677- ( smoothed_val, std_err, rob_weight)
681+ ( smoothed_val, std_err, rob_weight, result . iterations )
678682 }
679683 } ;
680684
@@ -685,6 +689,7 @@ impl<T: FloatLinalg + DistanceLinalg + Debug + Send + Sync + 'static + SolverLin
685689 std_error : std_err,
686690 residual : Some ( residual) ,
687691 robustness_weight : rob_weight,
692+ iterations_used : iterations,
688693 } ) )
689694 }
690695
0 commit comments