Closed zachcp closed 11 months ago
So for serde
to work I needed to invoke cargo differently:
// to https://github.com/rust-ml/linfa/blob/master/algorithms/linfa-trees/examples/decision_tree.rs
// add these deps
use bincode;
use std::fs::File;
// updated lines
let _encoded: Vec<u8> = bincode::serialize(&entropy_model).unwrap();
let mut file = File::create("my_data.bin").unwrap();
bincode::serialize_into(&mut file, &_encoded).unwrap();
cargo add bincode
cargo run --release --example decision_tree --features serde
The key here is --features serde
. You need to enable the serde
feature on linfa-trees
to enable the Serde support.
Hi Team-Linfa,
This is a wonderful effort and I am kicking the tires. One thing I would like to be able to do is to train a model and save the model to disk in order to reload/reuse it later. However, my initial attempts have all hit Serialization issues (see below). The source code seems to have serialization (and
derive
) enabled forDecisionTree
so I am not sure how to resolve this and I would appreciate any pointers.thanks! zach cp