use num_cpus; use rafor::prelude::*; use rafor::rf::Classifier;
fn main() {
#[rustfmt::skip]
let dataset = [
0.7, 0.0,
0.8, 1.0,
0.3, 0.0,
1.0, 1.3,
0.4, 2.1
];
let targets = [1, 5, 1, -15, 5];
let predictor = Classifier::trainer()
.with_max_depth(15)
.with_trees(40)
.with_threads(num_cpus::get())
.with_seed(42)
.train(&dataset, &targets);
let predictions = predictor.predict(&dataset, num_cpus::get());
println!("Predictions: {:?}", predictions);
let proba = predictor.proba(&dataset, num_cpus::get());
println!("Probability distributions:");
for p in proba.chunks(predictor.num_classes()) {
println!("{:?}", p);
}
}