Add EDM delay embedding infrastructure and tests#1528
Add EDM delay embedding infrastructure and tests#1528aman-raj-srivastva wants to merge 17 commits into
Conversation
🎨 Chore: code formatting workflowOur automated workflows cannot run on forks because of permission issues, and thus, we ask that you run the following code locally and push any changes that are created to your feature branch. You will only be reminded of this once per PR. Thank you! Format C++ code
Format R code
styler::style_pkg() # Style R code
roxygen2::roxygenise() # Update documentation
styler::style_pkg() # Style R code again
roxygen2::roxygenise() # Update documentation again
usethis::use_tidy_description() # Style DESCRIPTION filePush changes
|
|
On the uncertainty propagation, my assumption for now is to propagate observational uncertainty metadata (e.g. std error / variance vectors) along with the lag-coordinate embeddings, so later prediction and likelihood components can utilize them if needed. I just wanted to confirm if this direction makes sense regarding EDM / FIMS integration, before I move ahead with anything more elaborate. Also, I saw that my branch has merge conflicts with |
|
@aman-raj-srivastva sorry for the merge conflicts. Yes, rebasing to main is the best strategy. If you have problems, feel free to let me know and I can help out. |
|
Thanks! I’ll go ahead and rebase onto the latest |
added the comments to the following files: modified: R/distribution_formulas.R modified: R/fimsfit.R modified: R/initialize_modules.R modified: inst/include/common/information.hpp modified: inst/include/common/model.hpp modified: inst/include/distributions/functors/density_components_base.hpp modified: inst/include/distributions/functors/normal_lpdf.hpp modified: inst/include/interface/rcpp/rcpp_objects/rcpp_distribution.hpp modified: src/FIMS.cpp
- Created rcpp_edm.hpp defining EDMInterfaceBase and DelayEmbeddingInterface wrapper classes. - Exposed the construct(), construct_drop_missing(), and at() methods to R. - Exposed fields/metadata (such as embedding_dimension, time_lag, n_rows, n_cols, values, and target_indices) to R. - Registered the DelayEmbedding class in the RCPP_MODULE(fims) block within fims_modules.hpp.
- Add edm_embeddings list slot to the FIMSFrame S4 class to store delay-embedding results produced by create_edm_embedding() - Add create_edm_embedding() helper that pulls a named time series from the data slot, calls the Rcpp DelayEmbedding module, and returns a new FIMSFrame with the result stored by name - Add get_edm_embeddings() accessor following the existing get_*() pattern in fimsframe.R - Add model_edm_matrix() accessor that returns a numeric matrix (n_rows x E) ready to pass to an EDM prediction module, following the existing model_*() pattern - Register 'edm' as a valid FIMSFrame input type in data-raw/fims_input_types.R and regenerate data/fims_input_types.rda - Add tests/testthat/test-edm-fimsframe.R with 6 test blocks covering default empty slot, error handling, input validation, metadata correctness, matrix shape, and chaining multiple embeddings This completes proposal deliverable: 'Create structures in FIMSFrame for embedded matrices' (Weeks 1-3).
7e64860 to
dd00e76
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1528 +/- ##
==========================================
- Coverage 87.53% 87.50% -0.03%
==========================================
Files 97 101 +4
Lines 8749 9134 +385
Branches 523 559 +36
==========================================
+ Hits 7658 7993 +335
- Misses 1054 1103 +49
- Partials 37 38 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…r review feedback
Summary
This PR implements the initial delay embedding infrastructure for Empirical Dynamic Modeling (EDM) in FIMS as part of the GSoC 2026 project: “Add empirical dynamic model to FIMS”
This PR completes the main deliverables for:
What this PR adds
Core Delay Embedding Infrastructure
Implemented a reusable delay embedding generator for univariate time series in:
inst/include/edm/functors/delay_embedding.hppFeatures include:
E)tau)-999sentinel support)Rcpp Interface
Added EDM Rcpp integration in:
inst/include/interface/rcpp/rcpp_objects/rcpp_edm.hppThis includes:
DelayEmbeddingInterfaceRCPP_MODULE(fims)FIMSFrame Integration
Extended
FIMSFrameto support EDM embeddings by adding:edm_embeddingsstorage slotTesting
C++ (GoogleTest) —
tests/gtest/test_edm_delay_embedding.cpp6 test cases covering: basic 2D/3D embeddings, configurable lag,
short-series errors, invalid E/tau, and missing-value filtering.
R — Rcpp interface —
tests/testthat/test-rcpp-edm.R3 test blocks, 18 assertions covering: construct(), construct_drop_missing(),
and element access via at().
R — FIMSFrame —
tests/testthat/test-edm-fimsframe.R6 test blocks covering: empty slot default, missing embedding error,
input validation, metadata correctness, matrix shape, and chaining.
Additional Work
TODO(EDM)comments across key FIMS workflow files to guide future EDM and likelihood integration."edm"support tofims_input_types.Checklist
fims_input_typesallowlist updatedRelated Issue
Closes #1484 — Implement Delay Embedding Generator for Time Series
Instructions for code reviewer
👋Hello reviewer👋, thank you for taking the time to review this PR!
nit:(for nitpicking) as the comment type. For example,nit:I prefer using adata.frame()instead of amatrixbecause ...This PR is now ready to be merged.Checklist