How luckychiller/lutufi works
Lutufi is a Rust probabilistic graphical-model and network-analysis library with a Python API. The main workflow is to construct a Bayesian network, provide probability tables, query through an inference engine, and receive marginal results. The Rust core also supports learning, causal and structural analysis, dynamic models, and format interoperability. The graph follows the sampled Python-to-Rust inference path; several README capabilities are represented at their documented subsystem paths, but their internal wiring is not inferred where source was not sampled.
Main entry points: strategy_factory.rs Strategy selection · bayesian_network.rs Bayesian networks · inference.rs Inference bindings · learning.rs Learning bindings
Components 27
Python API
- Model API
bindings/python/lutufi/models.py - Inference API
bindings/python/lutufi/inference.py - Learning API
bindings/python/lutufi/learning.py - Python I/O
bindings/python/lutufi/io.py - Model bindings
bindings/ffi/models.rs - Inference bindings
bindings/ffi/inference.rs - Learning bindings
bindings/ffi/learning.rs - Network bindings
bindings/ffi/network.rs - Query result
bindings/python/lutufi/inference.py
Models and factors
- Bayesian networks
src/core/models/bayesian_network.rs - Network builder
src/core/models/bayesian_network_builder.rs - Factors and CPTs
src/core/factor/mod.rs - Dynamic networks
src/core/models/dynamic_bayesian_network.rs
Inference
- Inference facade
src/core/inference/engine.rs - Strategy selection
src/core/inference/strategy_factory.rs - Variable elimination
src/core/inference/variable_elimination.rs - Junction tree
src/core/inference/junction_tree.rs - Approximate inference
src/core/inference/lbp.rs - MCMC and variational
src/core/inference/mcmc.rs - Temporal queries
src/core/inference/dbn/temporal_query.rs
Learning and analysis
- Parameter learning
src/core/learning/parameter.rs - Structure learning
src/core/learning/structure/mod.rs - Causal analysis
src/core/models/causal_model/mod.rs - Network science
src/core/network/mod.rs
Interoperability
- Format conversion
src/core/io/mod.rs - BIF UAI LMF
src/core/io/lmf/mod.rs
Other components
- Python user
Connections 25
- Python user → Model API: builds model
- Python user → Inference API: submits query
- Python user → Learning API: learns model
- Python user → Python I/O: imports or exports
- Model API → Model bindings: wraps model
- Model bindings → Network builder: builds
- Network builder → Bayesian networks: creates
- Bayesian networks → Factors and CPTs: stores probabilities
- Inference API → Inference bindings: calls engines
- Inference bindings → Inference facade: runs query
- Inference facade → Strategy selection: selects strategy
- Strategy selection → Variable elimination: dispatches
- Strategy selection → Junction tree: dispatches
- Strategy selection → Approximate inference: dispatches
- Strategy selection → MCMC and variational: dispatches
- Inference facade → Bayesian networks: reads model
- Inference bindings → Query result: packs result
- Learning API → Learning bindings: calls estimators
- Learning bindings → Parameter learning: estimates parameters
- Learning bindings → Structure learning: learns structure
- Network bindings → Network science: runs analysis
- Bayesian networks → Causal analysis: supports causal analysis
- Dynamic networks → Temporal queries: queried by
- Python I/O → Format conversion: uses formats
- Format conversion → BIF UAI LMF: handles