0
$\begingroup$

I have a multivariate time series $X$ which has been time-based split to $X_{train}$ and $X_{test}$. If I wanted to do standard scaling without data leak, it is possible to learn the scaling parameters on $X_{train}$ and apply the same to $X_{test}$

X_train_scaled = StandardScaler.fit_transform(X_train)
X_test_scaled = StandardScaler.transform(X_test)

Similarly, is it possible to apply the Hodrick-Prescott filter without creating data leakage in regards to $X_{train}$ and $X_{test}$.? I am asking about both the mathematical and technical feasibility.

I assume that a working solution could exploit the current statmodels implementation of HP filter, but unfortunately there is no API resembling fit_transform / transform.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.