Expand description
Fast Causal Asymmetric Shapley Values for DAGs.
§Quick Start
use causasv::{AsvExplainer, CausasvError, Dag};
fn main() -> Result<(), CausasvError> {
let mut dag = Dag::new();
let x = dag.add_node("X");
let y = dag.add_node("Y");
dag.add_edge(x, y)?;
let explainer = AsvExplainer::new(dag);
let result = explainer.exact(|coalition| Ok(coalition.len() as f64))?;
for (id, val) in &result.values {
println!("{id:?} = {val:.4}");
}
Ok(())
}For large graphs use AsvExplainer::approximate or AsvExplainer::auto.
See the README for Python usage and benchmarks.
Re-exports§
pub use asv::AsvExplainer;pub use asv::AsvResult;
Modules§
Structs§
- Dag
- Directed acyclic graph with stable node indexing.
- NodeId
- Sampling
Config - Configuration for approximate ASV sampling.
Enums§
Functions§
- enumerate_
topos - Enumerates ALL valid topological orderings. Output is deterministic (frontier sorted by NodeId at each step). Only practical for small graphs (n ≤ ~8).
- topo_
sort - Returns a valid topological ordering (smallest NodeId first among ties).
Type Aliases§
- ValueFn
- Type alias for a value function over node coalitions. The library guarantees the coalition slice is sorted in ascending NodeId order before calling, so callers may use it as a stable cache key.