pub struct CorrectionFeatures {
pub baseline_estimate: u64,
pub left_input_rows: Option<u64>,
pub right_input_rows: Option<u64>,
pub left_distinct: Option<u64>,
pub right_distinct: Option<u64>,
pub predicate_count: u32,
pub join_depth: u32,
}Expand description
Feature vector handed to the corrector at estimate time.
Intentionally minimal at v0.0.1: row count + distinct count + null count + a small set of operator-level features. Will grow as the feedback-collection surface widens.
§Examples
use samkhya_core::residual::CorrectionFeatures;
let features = CorrectionFeatures {
baseline_estimate: 1000,
left_input_rows: Some(500),
right_input_rows: Some(2000),
predicate_count: 2,
join_depth: 1,
..Default::default()
};
assert_eq!(features.to_vec().len(), CorrectionFeatures::FEATURE_LEN);Fields§
§baseline_estimate: u64§left_input_rows: Option<u64>§right_input_rows: Option<u64>§left_distinct: Option<u64>§right_distinct: Option<u64>§predicate_count: u32§join_depth: u32Implementations§
Source§impl CorrectionFeatures
impl CorrectionFeatures
Sourcepub const FEATURE_LEN: usize = 7
pub const FEATURE_LEN: usize = 7
Number of entries to_vec produces.
Sourcepub fn to_vec(&self) -> Vec<f64>
pub fn to_vec(&self) -> Vec<f64>
Flatten the feature struct into a fixed-length numeric vector for a
regression model. Option<u64> slots are zero-filled when absent —
callers should treat zero as “unknown” rather than “literally zero
rows”, which is the convention the corrector is trained against.
Layout (stable; new features must be appended, never reordered):
baseline_estimateleft_input_rows(0 ifNone)right_input_rows(0 ifNone)left_distinct(0 ifNone)right_distinct(0 ifNone)predicate_countjoin_depth
§Examples
use samkhya_core::residual::CorrectionFeatures;
let f = CorrectionFeatures {
baseline_estimate: 100,
left_input_rows: Some(10),
predicate_count: 3,
..Default::default()
};
let v = f.to_vec();
assert_eq!(v[0], 100.0);
assert_eq!(v[1], 10.0);
assert_eq!(v[2], 0.0); // None → 0
assert_eq!(v[5], 3.0);Trait Implementations§
Source§impl Clone for CorrectionFeatures
impl Clone for CorrectionFeatures
Source§fn clone(&self) -> CorrectionFeatures
fn clone(&self) -> CorrectionFeatures
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CorrectionFeatures
impl Debug for CorrectionFeatures
Source§impl Default for CorrectionFeatures
impl Default for CorrectionFeatures
Source§fn default() -> CorrectionFeatures
fn default() -> CorrectionFeatures
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CorrectionFeatures
impl RefUnwindSafe for CorrectionFeatures
impl Send for CorrectionFeatures
impl Sync for CorrectionFeatures
impl Unpin for CorrectionFeatures
impl UnsafeUnpin for CorrectionFeatures
impl UnwindSafe for CorrectionFeatures
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