2 releases
Uses new Rust 2024
new 0.1.1 | Apr 6, 2025 |
---|---|
0.1.0 | Apr 6, 2025 |
#6 in #catboost
100KB
211 lines
Catboost inference
There are some Catboost Rust crates, but they're based on bindings to the C++ API and handle both training and inference, which makes them highly complicated to build and use. This is a simple library that just handles inference.
To use, save your catboost classifier to JSON, like so (python):
classifier.save_model(
"my-model",
format="json",
)
Then use it from Rust like so:
use catboost::Catboost;
use std::path::Path;
let model = CatBoost::load(Path::new("my-model.json")).unwrap();
let test_features: Vec<f32> = vec![0.1276993, 0.9918129, 0.16597846, 0.98612934];
let probability = model.predict(&test_features).unwrap();
Note: the model does not currently support categorical features.
Dependencies
~0.7–1.5MB
~33K SLoC