temporal-compare 0.5.0

High-performance framework for benchmarking temporal prediction algorithms inspired by Time-R1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::data::{Sample, to_class};

/// Naive baseline: next = last_in_window; class from that
pub struct Baseline;

impl Baseline {
    pub fn predict_reg(samples: &[Sample], window: usize) -> Vec<f32> {
        samples.iter().map(|s| s.x[window-1]).collect()
    }

    pub fn predict_cls(samples: &[Sample], window: usize) -> Vec<usize> {
        samples.iter().map(|s| {
            let yhat = s.x[window-1];
            to_class(yhat)
        }).collect()
    }
}