From a32957c23597b1746a1d717ef4adde1f33208c6b Mon Sep 17 00:00:00 2001 From: Shing Chan Date: Wed, 6 Nov 2024 17:33:31 +0000 Subject: [PATCH] fix(classification): skip model predict if input all NA --- src/accelerometer/classification.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/accelerometer/classification.py b/src/accelerometer/classification.py index 6996dc23..a0577c79 100644 --- a/src/accelerometer/classification.py +++ b/src/accelerometer/classification.py @@ -55,7 +55,8 @@ def activityClassification( print(f"{len(epoch) - np.sum(ok)} rows with NaN or Inf values, out of {len(epoch)}") Y = pd.Series(index=epoch.index) - Y.loc[ok] = viterbi(model.predict(X[ok]), hmmParams) + if ok.any(): + Y.loc[ok] = viterbi(model.predict(X[ok]), hmmParams) # TODO: Chan's logic hardcoded here if activityModel == 'chan':