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
pub fn mse(y: &[f32], yhat: &[f32]) -> f32 {
    y.iter().zip(yhat).map(|(a,b)| (a-b)*(a-b)).sum::<f32>() / y.len() as f32
}

pub fn acc(y: &[usize], yhat: &[usize]) -> f32 {
    let c = y.iter().zip(yhat).filter(|(a,b)| a==b).count();
    c as f32 / y.len() as f32
}