pub struct ModelBundle {
pub architecture: String,
pub input_features: usize,
pub hyperparameters: HashMap<String, Value>,
pub weights: Vec<f32>,
pub norm_means: Vec<f32>,
pub norm_stds: Vec<f32>,
pub anomaly_threshold: Option<f32>,
}Expand description
Full bundle payload carrying everything the ONNX converter needs.
The hyperparameters map uses flexible JSON to accommodate per-architecture
configs (e.g. LSTM wants hidden_dim + num_layers + sequence_length,
ViT wants patch_size + num_heads, etc). Keys are snake_case to match
the Python converter’s expectations.
Fields§
§architecture: StringArchitecture tag (same as BundleHeader::architecture).
input_features: usizeNumber of input features.
hyperparameters: HashMap<String, Value>Free-form hyperparameter map (hidden_dim, num_layers, sequence_length, …).
weights: Vec<f32>Flat weight vector in layer-by-layer order expected by the converter.
norm_means: Vec<f32>Per-feature input-normalization means (empty if no normalization was applied).
norm_stds: Vec<f32>Per-feature input-normalization std-devs.
anomaly_threshold: Option<f32>Anomaly/decision threshold for binary models (optional).
Implementations§
Source§impl ModelBundle
impl ModelBundle
Sourcepub fn new(architecture: &str, input_features: usize, weights: Vec<f32>) -> Self
pub fn new(architecture: &str, input_features: usize, weights: Vec<f32>) -> Self
Construct a new bundle with no normalization stats and no anomaly threshold.
Sourcepub fn with_hyperparam(self, key: &str, value: impl Into<Value>) -> Self
pub fn with_hyperparam(self, key: &str, value: impl Into<Value>) -> Self
Set a single hyperparameter (overwrites any existing value).
Sourcepub fn with_normalization(self, means: Vec<f32>, stds: Vec<f32>) -> Self
pub fn with_normalization(self, means: Vec<f32>, stds: Vec<f32>) -> Self
Attach per-feature normalization statistics.
Sourcepub fn with_threshold(self, threshold: f32) -> Self
pub fn with_threshold(self, threshold: f32) -> Self
Attach an anomaly/decision threshold.
Sourcepub fn header(&self) -> BundleHeader
pub fn header(&self) -> BundleHeader
Derive the lightweight BundleHeader from this bundle.
Trait Implementations§
Source§impl Clone for ModelBundle
impl Clone for ModelBundle
Source§fn clone(&self) -> ModelBundle
fn clone(&self) -> ModelBundle
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 ModelBundle
impl Debug for ModelBundle
Source§impl<'de> Deserialize<'de> for ModelBundle
impl<'de> Deserialize<'de> for ModelBundle
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ModelBundle
impl RefUnwindSafe for ModelBundle
impl Send for ModelBundle
impl Sync for ModelBundle
impl Unpin for ModelBundle
impl UnsafeUnpin for ModelBundle
impl UnwindSafe for ModelBundle
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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>
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>
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