From 7fb6a74508b47eacc33082b73316bb0bdf61e0ab Mon Sep 17 00:00:00 2001 From: Ben Sully Date: Wed, 20 Nov 2024 17:03:53 +0000 Subject: [PATCH] fix: correctly set holiday feature to 1 for all holiday dates (#175) --- crates/augurs-prophet/src/prophet/prep.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/augurs-prophet/src/prophet/prep.rs b/crates/augurs-prophet/src/prophet/prep.rs index a4293cc4..5893c878 100644 --- a/crates/augurs-prophet/src/prophet/prep.rs +++ b/crates/augurs-prophet/src/prophet/prep.rs @@ -687,11 +687,11 @@ impl Prophet { }; let mut col = vec![0.0; ds.len()]; - // Get the index of the adjusted date in the original data, if it exists. - // Set the value of the holiday column 1.0 for that date. - if let Some(loc) = ds + // Get the indices of the ds column that are 'on holiday'. + // Set the value of the holiday column 1.0 for those dates. + for loc in ds .iter() - .position(|x| (x - (x % ONE_DAY_IN_SECONDS_INT)) == occurrence) + .positions(|x| (x - (x % ONE_DAY_IN_SECONDS_INT)) == occurrence) { col[loc] = 1.0; }