DeepLabCut SARIMAX parameters

I am using DeepLabCut to track some very small animals (a few pixels) in a large, heterogenous lighting environment. I am trying to use the ARIMA filter to see if the autoregressive model can help filter out false positives (other small, non-animal particles that don’t demonstrate such predictive movement). However, I’m not familiar with the model parameters (ARdegree, MAdegree) and I’m curious if there’s a way in deeplabcut to determine what the best model values should be. I do not have an a priori estimate of what the ARdegree should be, and I imagine that this value can change for a given dataset. Is there a way for DLC to output the AR and MA terms/plots (as from here) to help better estimate what these values should be?

1 Like

Dear @Nicholai_Hensley ,

The meaning of the AR, MA parameters is discussed here: https://en.wikipedia.org/wiki/Autoregressive_integrated_moving_average

The best way to find the best parameters would be to cross validate them. Unfortunately, there is currently no built in option to cross-validate the parameters. However, you could run

for various parameter settings of ARdegree & MAdegree and look at the stats of the models. The easiest way to do this would be to edit https://github.com/AlexEMG/DeepLabCut/blob/a09bb5296428b161fd53900f45107523ea6452a7/deeplabcut/refine_training_dataset/outlier_frames.py#L211

which is used for fitting (for each body part) and then also extract the stats from the fitted models:
if you pass disp=True you get all kinds of statistics trom the sarimax class
https://www.statsmodels.org/stable/generated/statsmodels.tsa.statespace.sarimax.SARIMAX.html)

Alexander