pub struct ConTreeLds { /* private fields */ }Expand description
Anytime ConTree search based on limited discrepancy search.
The search runs in passes. Each pass explores the tree space under a
discrepancy budget (how far down the Gini ranking of features it may go)
and, for some point selectors, a split budget (how many thresholds per
feature it may try). A BudgetSchedule widens both budgets between
passes, so a good tree is available early and the last complete pass
proves optimality.
Implementations§
Source§impl ConTreeLds
impl ConTreeLds
Sourcepub fn with_config(config: SearchConfig) -> Self
pub fn with_config(config: SearchConfig) -> Self
Builds a solver from a SearchConfig.
This is the preferred constructor; Self::new takes the same
settings as positional arguments.
Sourcepub fn new(
min_sup: usize,
max_depth: usize,
max_time: f64,
max_error: usize,
split_selection_strategy: PointSelector,
max_gap: usize,
use_heuristic: bool,
fast_d2: bool,
) -> Self
pub fn new( min_sup: usize, max_depth: usize, max_time: f64, max_error: usize, split_selection_strategy: PointSelector, max_gap: usize, use_heuristic: bool, fast_d2: bool, ) -> Self
Builds a solver from positional settings. See Self::with_config.
Sourcepub fn with_random_state(self, seed: u64) -> Self
pub fn with_random_state(self, seed: u64) -> Self
Seeds the random generator used by PointSelector::Random, making
runs reproducible. Unseeded solvers draw their seed from the OS.
Sourcepub fn fit(&mut self, dataset: &Dataset) -> Result<FitOutcome, SearchError>
pub fn fit(&mut self, dataset: &Dataset) -> Result<FitOutcome, SearchError>
Runs the anytime search until it stops.
Each pass widens the discrepancy and split budgets. The search ends when a pass completes without being truncated (the tree is optimal), when the schedule has no larger budget to offer, or when the time limit is reached.
Sourcepub fn with_schedule(self, schedule: ScheduleKind) -> Self
pub fn with_schedule(self, schedule: ScheduleKind) -> Self
Chooses how the budget widens from pass to pass. See ScheduleKind.
Sourcepub fn schedule(&self) -> ScheduleKind
pub fn schedule(&self) -> ScheduleKind
The budget schedule this solver uses.
Sourcepub fn config(&self) -> &SearchConfig
pub fn config(&self) -> &SearchConfig
The configuration this solver was built with.
Sourcepub fn trajectory(&self) -> &[(f64, usize)]
pub fn trajectory(&self) -> &[(f64, usize)]
The anytime profile of the last fit: (seconds, error) at every
improvement of the root incumbent.
Sourcepub fn status(&self) -> SearchStatus
pub fn status(&self) -> SearchStatus
Why the last fit stopped.
Sourcepub fn partial_fit(&mut self, root_view: &DataView<'_>) -> bool
pub fn partial_fit(&mut self, root_view: &DataView<'_>) -> bool
Runs one pass of the search and returns true once the search is
over. The first call initialises the cache and the budget schedule.
pub fn statistics(&self) -> &Statistics
pub fn select_point(&mut self, config: &SearchConfig, bound: &Bound) -> usize
Sourcepub fn get_solution_tree(&mut self) -> Tree
pub fn get_solution_tree(&mut self) -> Tree
The tree found by the passes run so far.