-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmv_adapt_avg.mli
More file actions
42 lines (32 loc) · 1.09 KB
/
Copy pathmv_adapt_avg.mli
File metadata and controls
42 lines (32 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
(*
Exponential moving average with alpha parameter that
adjusts depending on the signal's stability.
It's designed for returning the most desirable value of a signal
that converges toward some value:
- before stabilizing, preference is given to the latest value
- after stabilizing, preference is give to noise removal
*)
type state
val init :
?alpha_gain:float ->
?alpha_min:float ->
?alpha_max:float ->
?track_variance:bool ->
unit -> state
(* Initialize a tracker.
`track_variance` must be set to true for tracking variance and
standard deviation. *)
val get : state -> float
(* Return the moving average. *)
val get_age : state -> int
(* Return the number of observations so far. *)
val get_stdev : state -> float
(* Return the moving standard deviation.
Requires the `track_variance` option. *)
val get_normalized : state -> float
(* Return the normalized signal.
Requires the `track_variance` option. *)
val update : state -> float -> unit
(* Add an observation to the tracker. *)
(**/**)
val get_alpha_tracker : state -> Mv_adapt.state