Skip to main content

RuleContext

Struct RuleContext 

Source
pub struct RuleContext {
    pub depth: usize,
    pub upper_bound: f64,
    pub node_lower_bound: f64,
    pub node_upper_bound: f64,
    pub item: usize,
    pub support: usize,
    pub position: usize,
    pub discrepancy: usize,
    pub gain: f64,
    pub error: f64,
    pub leaf_error: f64,
}
Expand description

What the rules know about the node being evaluated.

Fields§

§depth: usize

Depth of the node (the root is at 0).

§upper_bound: f64

Error the subtree must beat to be of use to its parent.

§node_lower_bound: f64

Proven lower bound on the node’s error.

§node_upper_bound: f64

Upper bound the node was last solved under (infinite if never).

§item: usize

The item (feature and branch) leading to the node.

§support: usize

Number of instances in the node.

§position: usize

Rank of the node’s feature among its siblings.

§discrepancy: usize

Sum of the ranks along the path from the root.

§gain: f64

Accumulated heuristic score lost along the path by not taking the best-ranked feature.

§error: f64

Best error found so far for the node.

§leaf_error: f64

Error of the node as a leaf.

Implementations§

Source§

impl RuleContext

Source

pub fn depth(&mut self, depth: usize)

Source

pub fn upper_bound(&mut self, upper_bound: f64)

Source

pub fn node_lower_bound(&mut self, node_lower_bound: f64)

Source

pub fn node_upper_bound(&mut self, node_upper_bound: f64)

Source

pub fn item(&mut self, item: usize)

Source

pub fn support(&mut self, support: usize)

Source

pub fn position(&mut self, position: usize)

Source

pub fn gain(&mut self, gain: f64)

Source

pub fn error(&mut self, error: f64)

Source

pub fn leaf_error(&mut self, error: f64)

Source

pub fn discrepancy(&mut self, discrepancy: usize)

Trait Implementations§

Source§

impl Debug for RuleContext

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RuleContext

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.