pub(crate) mod builder;
pub(crate) mod compact;
pub(crate) mod constraints;
pub(crate) mod gain;
pub(crate) mod hist;
pub(crate) mod linear;
pub(crate) mod linear_fit;
pub(crate) mod oblivious;
mod regtree;
pub(crate) mod reuse;
pub(crate) mod sampler;
pub use linear::LinearLeaves;
pub(crate) use regtree::{ChildLeaf, SplitRule, UncheckedRegTree};
pub use regtree::{Node, RegTree};
#[inline]
pub(crate) fn scalar_tree_output(t: usize, num_parallel_tree: usize, n_outputs: usize) -> usize {
(t / num_parallel_tree) % n_outputs
}
#[inline]
pub(crate) fn in_category_set(categories: &[u32], v: f32) -> bool {
categories.contains(&(v as u32))
}
#[derive(Debug, Clone, Copy)]
pub(crate) enum SplitTest<'a> {
Threshold(f32),
Categories(&'a [u32]),
}
#[inline]
pub(crate) fn split_goes_left(value: Option<f32>, default_left: bool, test: SplitTest<'_>) -> bool {
match (value, test) {
(None, _) => default_left,
(Some(v), SplitTest::Threshold(threshold)) => v < threshold,
(Some(v), SplitTest::Categories(categories)) => in_category_set(categories, v),
}
}