Expand description
Rustrees is a library for building decision trees and random forests.
The goal is to provide a fast implementation of decision trees in rust, with a python API.
Example usage:
use rustrees::{DecisionTree, Dataset, r2};
let dataset = Dataset::read_csv("datasets/titanic_train.csv", ",");
let dt = DecisionTree::train_reg(
&dataset,
Some(5), // max_depth
Some(1), // min_samples_leaf
None, // max_features (None = all features)
Some(42), // random_state
);
let pred = dt.predict(&dataset);
println!("r2 score: {}", r2(&dataset.target_vector, &pred));
Structs§
- Dataset
- Dataset represents the data used to train the model.
- Decision
Tree - Represents the decision tree model. Each node represents a split on a feature.
- Random
Forest - Represents the Random forest model. It is basically a collection of decision trees.
- Train
Options - Possible options for training the model.
- Tree
- An arena-based tree implementation. Each node is stored in a vector and the children are accessed by index.