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

Thoughts about user interface #22

Open
mscroggs opened this issue Mar 19, 2025 · 1 comment
Open

Thoughts about user interface #22

mscroggs opened this issue Mar 19, 2025 · 1 comment
Labels
question Further information is requested

Comments

@mscroggs
Copy link
Collaborator

mscroggs commented Mar 19, 2025

Creating this issue to dump thoughts about eventual user interface to come back to later:

  • Creating the graphs could be completely hidden from most users: when the user asks for (eg) the expectation of X, we could construct the graph of X and its dependencies in the background at that point, then use it in the computation. Each node will know how it depends on its dependencies so we can iterate recursively through parents and work out the entire graph.
    This is similar to what is done in UFL: when a UFL form is created, the graph is created in the background, but the user does not explicitly have to ask for it
  • Should we require that users give every node a label, or automatically label nodes that aren't given labels? Make two node example graph #16 originally did that later, but I'm now thinking that this may be a premature optimisation so am enforcing the giving of names for now

See also #13

@mscroggs mscroggs added the question Further information is requested label Mar 20, 2025
@mscroggs
Copy link
Collaborator Author

mscroggs commented Mar 21, 2025

Creating the graphs could be completely hidden from most users: when the user asks for (eg) the expectation of X, we could construct the graph of X and its dependencies in the background at that point, then use it in the computation.

We could aim for the user interface for the two node test to be something like this:

ux = DistributionNode(NormalFamily(), "UX", constant_parameters={"mean": mean, "cov": stdev**2})
x = DistributionNode(NormalFamily(), "X", parameters={"mean": ux}, constant_parameters={"cov": stdev2**2})
result = causalprog.algorithms.expectation(x, samples=samples, rng_key=rng_key)

or even:

ux = NormalDistribution("UX", mean, stdev)
x = NormalDistribution("X", ux, stdev2)
result = causalprog.algorithms.expectation(x, samples=samples, rng_key=rng_key)

All the information needed to create the tree is known by x, so the tree could be created inside ausalprog.algorithms.expectation.

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

No branches or pull requests

1 participant