pub struct ModelMetadata {
pub version: String,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub model_type: String,
pub num_features: usize,
pub num_trees: usize,
pub parameters: HashMap<String, String>,
}Expand description
Re-exported serialization utilities.
This includes model persistence with versioning, metadata tracking, and support for multiple serialization formats. Metadata describing a serialized model.
Tracks versioning, creation info, and model characteristics to ensure reproducibility and compatibility.
Fields§
§version: StringSemantic version of the library that created the model.
created_at: DateTime<Utc>Timestamp when the model was first saved.
updated_at: DateTime<Utc>Timestamp when the model was last updated.
model_type: StringType of model (e.g., “gradient_booster”, “decision_tree”).
num_features: usizeNumber of features the model expects.
num_trees: usizeNumber of trees in the ensemble (if applicable).
parameters: HashMap<String, String>Model hyperparameters and configuration.
Implementations§
Source§impl ModelMetadata
impl ModelMetadata
Sourcepub fn new(model_type: &str, num_features: usize, num_trees: usize) -> Self
pub fn new(model_type: &str, num_features: usize, num_trees: usize) -> Self
Creates new metadata for a model.
Automatically sets version to current crate version and timestamps to now.
§Arguments
model_type- Identifier for the model typenum_features- Number of input featuresnum_trees- Number of trees (0 for single models)
Sourcepub fn with_parameter(self, key: &str, value: &str) -> Self
pub fn with_parameter(self, key: &str, value: &str) -> Self
Sourcepub fn validate_version(&self) -> SerializationResult<()>
pub fn validate_version(&self) -> SerializationResult<()>
Validates that the model version matches the current library version.
§Returns
Ok(()) if versions match, Err(SerializationError::VersionMismatch) otherwise
Trait Implementations§
Source§impl Clone for ModelMetadata
impl Clone for ModelMetadata
Source§fn clone(&self) -> ModelMetadata
fn clone(&self) -> ModelMetadata
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ModelMetadata
impl Debug for ModelMetadata
Source§impl<'de> Deserialize<'de> for ModelMetadata
impl<'de> Deserialize<'de> for ModelMetadata
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 ModelMetadata
impl RefUnwindSafe for ModelMetadata
impl Send for ModelMetadata
impl Sync for ModelMetadata
impl Unpin for ModelMetadata
impl UnwindSafe for ModelMetadata
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,
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