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

memory issue with new summary approach #364

Open
macartan opened this issue Oct 11, 2024 · 5 comments
Open

memory issue with new summary approach #364

macartan opened this issue Oct 11, 2024 · 5 comments
Assignees

Comments

@macartan
Copy link
Collaborator

macartan commented Oct 11, 2024

the new summary approach generates a lot of large objects, like the parameter matrix and the ambiguity matrix; on the fly. other code avoids the generation of these, making them on a need to know basis

this will be unmanageable with larger models:

> model <- make_model("A -> Y <- B; C-> Y", add_causal_types = FALSE)
> summary <- summary(model)
> object.size(model)
82256 bytes
> object.size(summary)
79637008 bytes

it seems that if a summary is called for then everything gets piled into this objects including all posterior distributions, stan objects and so on

can we revert to generating these only when they are explicitly requested?

@gerasy1987
Copy link
Collaborator

@macartan, thanks for pointing this out. I can work on this next week. Do you have a preference for what objects should be in the summary by default beyond what is in the causal_model it is called on?

@macartan
Copy link
Collaborator Author

macartan commented Oct 14, 2024 via email

@gerasy1987
Copy link
Collaborator

@macartan proposed fix is in #366 and ready for review

@gerasy1987
Copy link
Collaborator

addressed by #366

@macartan
Copy link
Collaborator Author

Sorry to reopen -- we cannot run all the code in the paper because of the memory requirements of the summary approach

we want to to do this:

make_model("A -> E <- B; C-> E <- D", add_causal_types = FALSE) |>
  grab("parameters") |> 
  length()

but grabbing requires creating causal types and other very large objects

seems we are back to this issue of why generate all these things on the fly when they are not needed or saved

note this is still fast:

make_model("A -> E <- B; C-> E <- D", add_causal_types = FALSE) |>
  CausalQueries:::get_parameters() |>
  length()

grab and inspect really target particular objects and seems wise to create the objects targeted and nothing else.

@macartan macartan reopened this Nov 11, 2024
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

2 participants