pub struct NumericFeatureBuffer {
pub feature_set_id: String,
pub representation_id: RepresentationId,
pub feature_names: Vec<String>,
pub observation_ids: Vec<ObservationId>,
/* private fields */
}Fields§
§feature_set_id: String§representation_id: RepresentationId§feature_names: Vec<String>§observation_ids: Vec<ObservationId>Implementations§
Source§impl NumericFeatureBuffer
impl NumericFeatureBuffer
pub fn from_feature_table(table: CoordinatorFeatureTable) -> Result<Self>
pub fn from_f64_matrix(matrix: NumericFeatureMatrixF64) -> Result<Self>
pub fn from_f64_column_matrix( matrix: NumericFeatureMatrixF64Columnar, ) -> Result<Self>
pub fn row_count(&self) -> usize
pub fn feature_count(&self) -> usize
pub fn value_count(&self) -> usize
pub fn estimated_value_bytes(&self) -> usize
pub fn contains_observation(&self, observation_id: &ObservationId) -> bool
Sourcepub fn fingerprint(&self) -> Result<String>
pub fn fingerprint(&self) -> Result<String>
Reproducibility fingerprint of the buffer’s logical content as a 64-char lowercase hex SHA-256.
The preimage is fed to the hasher incrementally — there is NO
O(n_cells) intermediate byte vector or per-cell boxed value — so a
multi-million-cell matrix costs one fixed scratch buffer, not a
transient copy of the whole payload (the old serde_json::to_vec path).
Preimage layout (every multi-byte field little-endian; every variable-length field/collection length-prefixed so framing is unambiguous):
domain tag b"dag-ml-data.numeric-feature-buffer.v2\0" (fixed literal)
feature_set_id : str (u64 byte-len, then UTF-8)
representation_id : str (u64 byte-len, then UTF-8)
feature_names : str[] (u64 count, then each str)
observation_ids : str[] (u64 count, then each str)
n_rows : u64 (fixed-width LE)
n_cols : u64 (fixed-width LE)
cells row-major over (row, col):
each cell : 1 presence byte (1=Some, 0=None) + 8 LE f64 bytesRationale for the load-bearing choices:
- Shape is hashed explicitly as fixed-width
n_rows/n_cols, and the cell stream is emitted in one fixed traversal, so a2x3and a3x2buffer with identical flat values produce different digests. - Storage is column-major (
columns[feature][row]); we deliberately traverse row-major over(row, col)and document that fixed order here. The constructors normalize both row-major and column-major typed inputs into the samecolumnsstorage, so the same logical matrix always streams in the same order regardless of input layout. - Masked cells emit a
0presence byte then 8 zero value bytes, a fixed 9-byte stride. The presence byte alone separatesNonefromSome(0.0)(whose value bytes are also all zero), so a mask flip is never indistinguishable from a real value.
pub fn manifest(&self) -> Result<NumericFeatureBufferManifest>
Sourcepub fn to_f64_column_matrix(&self) -> NumericFeatureMatrixF64Columnar
pub fn to_f64_column_matrix(&self) -> NumericFeatureMatrixF64Columnar
Returns the buffer’s contents as a NumericFeatureMatrixF64Columnar,
suitable for binary persistence or pass-through to other typed-input
constructors. The output is the inverse of
NumericFeatureBuffer::from_f64_column_matrix: a round-trip through
this method and the constructor preserves the buffer fingerprint.
pub fn selected_indices(&self, columns: Option<&[String]>) -> Result<Vec<usize>>
pub fn project_relations( &self, relations: &CoordinatorRelationSet, source_id: Option<&SourceId>, columns: Option<&[String]>, ) -> Result<CoordinatorFeatureBlock>
Sourcepub fn project_relations_f64(
&self,
relations: &CoordinatorRelationSet,
source_id: Option<&SourceId>,
columns: Option<&[String]>,
) -> Result<CoordinatorFeatureBlockF64>
pub fn project_relations_f64( &self, relations: &CoordinatorRelationSet, source_id: Option<&SourceId>, columns: Option<&[String]>, ) -> Result<CoordinatorFeatureBlockF64>
Like Self::project_relations but flattens the cells row-major
straight into one Vec<f64> — no rows × cols boxed
serde_json::Values. This is the hot path for large numeric blocks
crossing a typed-array binding boundary. Masked (invalid) cells are an
error: the typed projection has no Null to project them into.
Trait Implementations§
Source§impl Clone for NumericFeatureBuffer
impl Clone for NumericFeatureBuffer
Source§fn clone(&self) -> NumericFeatureBuffer
fn clone(&self) -> NumericFeatureBuffer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NumericFeatureBuffer
impl Debug for NumericFeatureBuffer
Source§impl PartialEq for NumericFeatureBuffer
impl PartialEq for NumericFeatureBuffer
Source§fn eq(&self, other: &NumericFeatureBuffer) -> bool
fn eq(&self, other: &NumericFeatureBuffer) -> bool
self and other values to be equal, and is used by ==.