catboost-rs 0.1.1

(Forked from official) Rust bindings for catboost. Only changes for now are downloading libcatboost sharedlib instead of building, so that it can be more easily published to cargo without needing to clone the whole repo which can be quite big.
docs.rs failed to build catboost-rs-0.1.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: catboost-rs-0.1.8

CatBoost Rust Package

Basic usage example

  1. Add a dependency to your Cargo.toml:
[dependencies]
catboost = { git = "https://github.com/catboost/catboost" }
  1. Now you can apply pretrained model in your code:
// Bring catboost module into the scope
use catboost;

fn main() {
    // Load the trained model
    let model = catboost::Model::load("tmp/model.bin").unwrap();

    println!("Number of cat features {}", model.get_cat_features_count());
    println!("Number of float features {}", model.get_float_features_count());

    // Apply the model
    let prediction = model
        .calc_model_prediction(
            vec![
                vec![-10.0, 5.0, 753.0],
                vec![30.0, 1.0, 760.0],
                vec![40.0, 0.1, 705.0],
            ],
            vec![
                vec![String::from("north")],
                vec![String::from("south")],
                vec![String::from("south")],
            ],
        )
        .unwrap();
    println!("Prediction {:?}", prediction);
}

Documentation

Run cargo doc --open in catboost/rust-package directory.

Tests

Run cargo test in catboost/rust-package directory.

To run tests with sanitizer, uncomment line "--sanitize=address", in catboost/rust-package/catboost-sys/build.rs and run RUSTFLAGS="-Z sanitizer=address" cargo +nightly test.