pub struct PolicyTree { /* private fields */ }Expand description
A fitted policy tree.
Implementations§
Source§impl PolicyTree
impl PolicyTree
Sourcepub fn fit(
signal: ArrayView1<'_, f64>,
features: ArrayView2<'_, f64>,
depth: usize,
min_samples_leaf: usize,
ccp_alpha: f64,
) -> Result<Self>
pub fn fit( signal: ArrayView1<'_, f64>, features: ArrayView2<'_, f64>, depth: usize, min_samples_leaf: usize, ccp_alpha: f64, ) -> Result<Self>
Fit on the orthogonal signal (one value per unit) and the features the
policy may depend on. DoubleML’s defaults: min_samples_leaf = 8,
ccp_alpha = 0.01.
pub fn depth(&self) -> usize
pub fn min_samples_leaf(&self) -> usize
pub fn ccp_alpha(&self) -> f64
Sourcepub fn predict(&self, features: ArrayView2<'_, f64>) -> Result<Array1<f64>>
pub fn predict(&self, features: ArrayView2<'_, f64>) -> Result<Array1<f64>>
Recommended treatment (1) or not (0) for each row of features: the
class with the larger weighted share in the row’s leaf (no treatment on
ties, as scikit-learn’s argmax).
Sourcepub fn nodes(&self) -> Vec<PolicyNode>
pub fn nodes(&self) -> Vec<PolicyNode>
The nodes in preorder; node 0 is the root (for plotting the tree).
Sourcepub fn export_text(&self, feature_names: Option<&[String]>) -> String
pub fn export_text(&self, feature_names: Option<&[String]>) -> String
The decision rules as text, in the style of scikit-learn’s
export_text; feature_names defaults to x0, x1, ….
Trait Implementations§
Source§impl Clone for PolicyTree
impl Clone for PolicyTree
Auto Trait Implementations§
impl Freeze for PolicyTree
impl RefUnwindSafe for PolicyTree
impl Send for PolicyTree
impl Sync for PolicyTree
impl Unpin for PolicyTree
impl UnsafeUnpin for PolicyTree
impl UnwindSafe for PolicyTree
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more