Convert edge probability matrix(matrices) into consensus network #40
Description
Is your feature request related to a problem? Please describe.
Given some representation of a set of DAGs, we want to reduce this to one DAG. For example, given a collection of DAGs, or some graph posterior, construct a DAG.
Describe the solution you'd like
Input: A matrix of the probability of edge presence, and the probability of edge direction given presence
Output: A DAG.
Algo:
- Construct an undirected based on matrix 1 and a threshold.
- Construct a directed graph based on matrix 2 and a threshold.
- Remove edges based on some heuristic:
- Removes or reverses as few edges as possible
- Minimizes probabilistic loss (e.g. reverse X->Y is bad if it has a 99% chance of being true, but not so bad if it has a 50% chance of being true
Describe alternatives you've considered
https://rdrr.io/cran/bnlearn/src/R/averaged.network.R
Might need to work with only one matrix (the product of the two matrices I described). Many algorithms return such a matrix as output, especially those that use variational inference.
In my proposed approach a collection of graphs would be rendered into matrices. It might make sense to derive a consensus graph from a list of graphs directly. For example, one might try to preserve colliders across graphs in the collection.