Skip to content

FFSVM stands for "Really Fast Support Vector Machine"

License

Notifications You must be signed in to change notification settings

RUSTools/ffsvm-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Latest Version Travis-CI Status docs MIT

In One Sentence

You trained a non-sparse RBF-C-SVM using libSVM, now you want the highest possible performance during (real-time) classification, like games or VR.

Highlights

  • can load trained libSVM models (currently RBF-CSVM without sparse attributes)
  • optimized for SIMD and can be mixed seamlessly with Rayon.
  • allocation-free during classification
  • written in 100% Rust, but can be loaded from any language (via FFI)
  • 2.5x - 14x faster than libSVM
  • Free of unsafe code ;)

Principal Usage

Train with libSVM (e.g., using the tool svm-train), then classify with ffsvm-rust.

From Rust:

// Load model file / SVM.
let model_str: &str = include_str!("model.libsvm");
let model = ModelFile::try_from(model_str)?;
let csvm = RbfCSVM::try_from(&model)?;

// Produce problem we want to classify.
let mut problem = Problem::from(&csvm);

// Set features
problem.features = vec![ 0.3093766, 0.0, 0.0, 0.0, 0.0, 0.1764706, 0.1137485 ];

// Can be trivially parallelized (e.g., with Rayon) ...
csvm.predict_value(&mut problem);

// Results should match libSVM
assert_eq!(42, problem.label);

From C / FFI:

Please see FFSVM-FFI

Status

  • Aug 5, 2018: Still in alpha, but finally on crates.io.
  • May 27, 2018: We're in alpha. Successfully used internally on Windows, Mac, Android and Linux on various machines and devices. Once SIMD stabilizes and we can cross-compile to WASM we'll move to beta.
  • December 16, 2017: We're in pre-alpha. It will probably not even work on your machine.

Performance

performance

Classification time vs. libSVM.

performance

Performance milestones during development.

See here for details.

FAQ

See here for details.

About

FFSVM stands for "Really Fast Support Vector Machine"

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 97.2%
  • Python 2.8%