Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable sequence_length ts for MiniRocket Pytorch #860

Open
ChrystleMyrnaLobo opened this issue Nov 20, 2023 Discussed in #857 · 0 comments
Open

Variable sequence_length ts for MiniRocket Pytorch #860

ChrystleMyrnaLobo opened this issue Nov 20, 2023 Discussed in #857 · 0 comments

Comments

@ChrystleMyrnaLobo
Copy link

Discussed in #857

Originally posted by ChrystleMyrnaLobo November 14, 2023
Hi! I'm using the MiniRocket Pytorch implementation for multivariate time series classification. Thanks for the GPU compatible implementation! :D

I want to use it with variable sequence_length input. I do not want to make the ts data fixed length (by padding). Instead, treat it as variable length itself and leverage the fully convolutional network of MiniRocket. The input shape for MiniRocket feature extractor is n_samples x n_variables x sequence_length and output is n_samples x 9996 x 1 which is independent of the input sequence_length.

While there are no errors in the forward pass of MiniRocket, the output features have nan values for last few features/filter output when input sequence_length is lesser than the seq_len of MiniRocketFeatures constructor. Could you please help me understand why some features are nan? What should be the seq_len of MiniRocketFeatures constructor if the X_train has variable sequence_length?

Minimal code to reproduce the issue

# Creating the feature extractor
X_train = np.random.rand(5, 4, 1000)
model_mrf = MiniRocketFeatures(c_in=4, seq_len=1000).to(default_device())
model_mrf.fit(X_train.astype('float32'))

# Forward pass
X_test = np.random.rand(1, 4, 800)
print(X_test.shape)
print(np.linalg.norm(X_test))
X_test_feat = get_minirocket_features(X_test.astype('float32'), model_mrf, to_np=True)
print(X_test_feat.shape)
print(np.linalg.norm(X_test_feat))
print("Count of nan features", 9996-np.count_nonzero(~np.isnan(X_test_feat)))

Output

(1, 4, 800)
32.77988802149151
(1, 9996, 1)
nan
Count of nan features 252

Related discussion: this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant