powered by
Class which send a stop signal when a time series stay constant.
minit
[integer] Minimal number of iterations. At least 3.
maxit
[integer] Maximal number of iterations.
nit
[integer] Number of iterations.
tol
[float] Tolerance to control if slope is close to zero
stop
[bool] If we stop
criteria
[vector] State of criteria
slope
[vector] Values of slope
SlopeStoppingCriteria$new()
SlopeStoppingCriteria$reset()
SlopeStoppingCriteria$append()
SlopeStoppingCriteria$clone()
new()
Create a new SlopeStoppingCriteria object.
SlopeStoppingCriteria$new(minit, maxit, tol)
A new `SlopeStoppingCriteria` object.
reset()
Reset the class
NULL
append()
Add a new value
SlopeStoppingCriteria$append(value)
value
[double] New metrics
clone()
The objects of this class are cloneable with this method.
SlopeStoppingCriteria$clone(deep = FALSE)
deep
Whether to make a deep clone.
Test the slope.
stop_slope = SlopeStoppingCriteria$new( 20 , 500 , 1e-3 ) x = 0 while(!stop_slope$stop) { stop_slope$append(base::exp(-x)) x = x + 0.1 } print(stop_slope$nit)
Run the code above in your browser using DataLab