(
start: &str,
periods: usize,
freq_minutes: i64,
)
| 10 | use rand::SeedableRng; |
| 11 | |
| 12 | fn make_series( |
| 13 | start: &str, |
| 14 | periods: usize, |
| 15 | freq_minutes: i64, |
| 16 | ) -> Vec<(NaiveDateTime, NaiveDateTime)> { |
| 17 | let start_dt = NaiveDateTime::parse_from_str(start, "%Y-%m-%d %H:%M:%S").unwrap(); |
| 18 | (0..periods) |
| 19 | .map(|i| { |
| 20 | let idx = start_dt + chrono::Duration::minutes(i as i64 * freq_minutes); |
| 21 | let val = idx + chrono::Duration::minutes(3); |
| 22 | (idx, val) |
| 23 | }) |
| 24 | .collect() |
| 25 | } |
| 26 | |
| 27 | struct ThresholdClassifier { |
| 28 | threshold: f64, |
no outgoing calls
no test coverage detected