pub struct DecisionForest { /* private fields */ }Expand description
A random-forest classifier. Configure forest options such as
"number of trees" or "bootstrap" via DecisionForest::handle_mut
before calling DecisionForest::fit.
Implementations§
Source§impl DecisionForest
impl DecisionForest
Sourcepub fn handle_mut(&mut self) -> &mut Handle
pub fn handle_mut(&mut self) -> &mut Handle
Borrow the underlying handle to set forest options.
Sourcepub fn fit(
&mut self,
n_samples: usize,
n_features: usize,
n_class: usize,
x: &[f64],
y: &[i32],
) -> Result<()>
pub fn fit( &mut self, n_samples: usize, n_features: usize, n_class: usize, x: &[f64], y: &[i32], ) -> Result<()>
Fit on column-major n_samples × n_features features x with
integer class labels y. Pass n_class = 0 to let AOCL infer it.
Sourcepub fn predict(
&mut self,
n_samples: usize,
n_features: usize,
x_test: &[f64],
labels: &mut [i32],
) -> Result<()>
pub fn predict( &mut self, n_samples: usize, n_features: usize, x_test: &[f64], labels: &mut [i32], ) -> Result<()>
Predict class labels for n_samples × n_features test data.
Sourcepub fn score(
&mut self,
n_samples: usize,
n_features: usize,
x_test: &[f64],
y_test: &[i32],
) -> Result<f64>
pub fn score( &mut self, n_samples: usize, n_features: usize, x_test: &[f64], y_test: &[i32], ) -> Result<f64>
Compute prediction accuracy on a labelled test set.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for DecisionForest
impl !RefUnwindSafe for DecisionForest
impl !Sync for DecisionForest
impl Forget for DecisionForest
impl Move for DecisionForest
impl Send for DecisionForest
impl Unpin for DecisionForest
impl UnsafeUnpin for DecisionForest
impl UnwindSafe for DecisionForest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more