Skip to main content

Crate dtrees_rs

Crate dtrees_rs 

Source
Expand description

Decision trees over binary features.

  • DL8.5 learns optimal trees by dynamic programming with branch-and-bound and caching (Aglin, Nijssen and Schaus, AAAI 2020). With search rules it becomes anytime: limited discrepancy search (LDS-DL8.5, ECML PKDD 2022), Top-k, and the general CA-DL8.5 framework (IDA 2026). See algorithms::optimal::rules.
  • LGDT grows a tree greedily, choosing each test with a depth-2 lookahead (IDA 2024).

Data comes as a Cover, read from a text file by DataReader: one instance per line, the label first, then the 0/1 features.

use dtrees_rs::algorithms::greedy::factories::with_error_minimizer;
use dtrees_rs::algorithms::TreeSearchAlgorithm;
use dtrees_rs::reader::data_reader::DataReader;
use std::path::Path;

let mut cover = DataReader::default().read_file(Path::new("data.txt"))?;
let mut lgdt = with_error_minimizer().max_depth(4).min_support(5).build()?;
lgdt.fit(&mut cover)?;
println!("{}", lgdt.tree());

Modulesยง

algorithms
The tree learners: optimal (optimal: DL8.5 and depth-2 solvers) and greedy with lookahead (greedy: LGDT).
bitsets
Fixed-capacity bitsets.
caching
The cache of subproblems used by DL8.5.
cover
The instances reaching the current node of the search.
globals
Item encoding and small numeric helpers.
parsers
Command line parsing for the examples and the dtrees CLI.
reader
tree
Binary decision trees stored as an arena of nodes.