![Latest Version] ![Travis-CI Status] ![deps.svg] ![docs] ![MIT]
You trained a SVM using libSVM, now you want the highest possible performance during (real-time) classification, like games or VR.
unsafe
code ;)Note: Currently requires Rust nightly (March 2019 and later), because we depend on RFC 2366 (portable SIMD). Once that stabilizes we'll also go stable.
Train with libSVM (e.g., using the tool svm-train
), then classify with ffsvm-rust
.
From Rust:
``rust
// Replace
SAMPLEMODELwith a
&str` to your model.
let svm = DenseSVM::tryfrom(SAMPLE_MODEL)?;
let mut problem = Problem::from(&svm); let features = problem.features();
features[0] = 0.55838; features[1] = -0.157895; features[2] = 0.581292; features[3] = -0.221184;
svm.predict_value(&mut problem)?;
assert_eq!(problem.solution(), Solution::Label(42)); ```
From C / FFI:
Please see FFSVM-FFI
Classification time vs. libSVM for dense models.
Performance milestones during development.
All performance numbers reported for the DenseSVM
. We also have support for SparseSVM
s, which are slower for "mostly dense" models, and faster for "mostly sparse" models (and generally on the performance level of libSVM).