Expand description
pmmlruntime — PMML 4.4 runtime.
Modules base, xml, ir, engine, session, ffi, python — see docs/ARCHITECTURE.md.
§Modules
base— zero-cost typesValue/FieldId/DataType/PmmlError, arenaBumpArena(hot-path, no XML/IR — see docs/ARCHITECTURE.md).xml— hardenedquick-xml0.37 →RawPmml(cold path,MAX_DEPTH 512,100 MBcap, DTD/XXE blocked — seecrate::xml::reader).ir— optimizedIrfor posterior plan optimization (Arcimmutable,Vec<NodeIr>flat,DerivedFieldIrDAG withVec<Op>bytecode, coldRodeointerning).engine— pure evaluation on&[Value](19 models:Tree/Regression/Mining/Scorecard/Clustering/NaiveBayes/… +vmbytecode,simdwidef64x4whensimdfeature is active).session— session API (PmmlEnv+Session+Batch+ExecutionProviderCpu(autorayon) — see docs/ARCHITECTURE.md §2).ffi— C ABI with opaquePmmlEnv/PmmlSessionhandles andSafetycontracts (seecrate::ffi).python—pyo3 0.22extension-module placeholder (featurepython, seecrate::python).
§Primary API — session
use std::collections::HashMap;
use pmmlruntime::session::{PmmlEnv, Session, SessionOptions};
use pmmlruntime::session::batch::Batch;
use pmmlruntime::base::Value;
let env = PmmlEnv::new();
let xml = br#"
<PMML version="4.4"><Header/><DataDictionary><DataField name="x" dataType="double" optype="continuous"/></DataDictionary>
<TreeModel functionName="classification">
<MiningSchema><MiningField name="x"/></MiningSchema>
<Node score="a"><True/></Node>
</TreeModel></PMML>"#;
let sess = Session::from_bytes(&env, xml, SessionOptions::default()).unwrap();
let mut input = HashMap::new();
input.insert("x".to_string(), Value::Continuous(1.4));
let out = sess.run(&input as &dyn Batch).unwrap().into_single().unwrap();
assert!(out.contains_key("predictedValue"));§Feature flags
simd— enableswidef64x4batch forengine+session(cargo doc --features simd).python— enablespyo3extension-module (otherwise nolibpythonlink).
§Architecture
See docs/ARCHITECTURE.md for the bytes→RawPmml→Ir→Session::run(Value[FieldId]) flow, ownership Arc<Ir>,
concurrency rayon, and BumpArena vs LoadingCache tradeoffs.
Re-exports§
pub use base::FieldId;pub use base::PmmlError;pub use base::Result;pub use base::SymbolId;pub use base::Value;pub use session::PmmlEnv;pub use session::Session;pub use session::SessionOptions;
Modules§
- base
- Core — zero-cost foundation: arena, field types, values, errors.
- engine
- Engine — pure PMML evaluation on
&[Value]. - ffi
- C ABI — stable C API for PMML scoring.
- ir
- IR — optimized intermediate representation (
Ir). - python
- Python bindings —
PyO30.22extension-module, likeort.py. - session
- Session — session runtime-style
SessionAPI. - xml
- XML — hardened
quick-xml0.37 unmarshaling toRawPmml.
Constants§
- VERSION
- Crate version (workspace
0.1.0).