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

explicit outer product over common parameters with different parameter values #16

Open
kostrzewa opened this issue Apr 24, 2019 · 5 comments

Comments

@kostrzewa
Copy link
Member

Imagine you have values A_i parametrised by a set of parameters p^{A_i}_j and another set of value B_k parametrised by a set of parameters p^{B_k}_l.

The two parameter sets share some column names (and in general also some or all parameter values).

The functionality of inner_outer_join is great for producing some set of values C_m which is a combination of A and B, with the inner and outer combinations of the parameter sets taken into account automatically.

What if, however, I would like to combine A and B in a non-diagonal way in the parameters that they share (an outer product, possibly partial, across an inner margin, in some sense).

As an example, let's say A and B each have six parameters src_px src_py src_pz snk_px snk_py snk_pz, but the required combination of these parameters is one where none or just some of the values of src_px src_py src_pz snk_px snk_py snk_pz of A and B are the same. Formally, the new paramval C would thus have 12 parameters A.src_px A.src_py ... A.snk_pz B.src_px B.src_py ... B.snk_pz.

Of course, I can filter A and B "by hand" and create a new paramval with the combination that I would like, inventing the new parameters as required. But had you thought about a better way to do this perhaps?

@kostrzewa
Copy link
Member Author

This is further complicated by the fact that for some of the parameters that A and B carry and have in common, I would in fact like to perform the inner product (stuff like ensemble names, for example).

@kostrzewa
Copy link
Member Author

I guess this can be achieved via convert in the pv_call, but I'm not sure whether that actually can take care of exactly what I need to do. I'll give it a try.

@kostrzewa
Copy link
Member Author

Hmm, going via parameter_to_data is also quite inconvenient, although it at least makes the PVs conformable. I need to think about this...

@martin-ueding
Copy link
Contributor

One way that would not require me to do anything would be just parameter_to_data on each part separately, internally rename the values and then do a combined pv_call. Then you can do the dplyr SQL-like commands on the values.

One could also rename the parameters and then get an outer join with pv_call. In the function one then just returns NA when there is an invalid combination of the parameters. This effectively filters the container. Or one uses inner_outer_join manually and then pv_filter.

Perhaps we figure out a hackish but somewhat concise way to do this and then see whether it can be generalized?

@kostrzewa
Copy link
Member Author

I think at this point I've basically reached the conclusion that it's too much trouble to be worth doing. I'm taking a different approach by using paramval's to represent only certain (very broad) parameter-value dependencies while I use an internal representation with another lookup-table-like construction to resolve fine-grained paramter-value relationships to form the required (partial) outer products.

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