Struct surrealml_core::storage::header::Header
source · pub struct Header {
pub keys: KeyBindings,
pub normalisers: NormaliserMap,
pub output: Output,
pub name: StringValue,
pub version: Version,
pub description: StringValue,
pub engine: Engine,
pub origin: Origin,
pub input_dims: InputDims,
}
Expand description
The header of the model file.
§Fields
keys
- The key bindings where the order of the input columns is stored.normalisers
- The normalisers where the normalisation functions are stored per column if there are any.output
- The output where the output column name and normaliser are stored if there are any.name
- The name of the model.version
- The version of the model.description
- The description of the model.engine
- The engine of the model (could be native or pytorch).origin
- The origin of the model which is where the model was created and who the author is.
Fields§
§keys: KeyBindings
§normalisers: NormaliserMap
§output: Output
§name: StringValue
§version: Version
§description: StringValue
§engine: Engine
§origin: Origin
§input_dims: InputDims
Implementations§
source§impl Header
impl Header
sourcepub fn fresh() -> Self
pub fn fresh() -> Self
Creates a new header with no columns or normalisers.
§Returns
A new header with no columns or normalisers.
sourcepub fn add_name(&mut self, model_name: String)
pub fn add_name(&mut self, model_name: String)
Adds a model name to the self.name
field.
§Arguments
model_name
- The name of the model to be added.
sourcepub fn add_version(&mut self, version: String) -> Result<(), SurrealError>
pub fn add_version(&mut self, version: String) -> Result<(), SurrealError>
sourcepub fn add_description(&mut self, description: String)
pub fn add_description(&mut self, description: String)
Adds a description to the self.description
field.
§Arguments
description
- The description to be added.
sourcepub fn add_column(&mut self, column_name: String)
pub fn add_column(&mut self, column_name: String)
Adds a column name to the self.keys
field. It must be noted that the order in which the columns are added is
the order in which they will be expected in the input data. We can do this with the followng example:
§Arguments
column_name
- The name of the column to be added.
sourcepub fn add_normaliser(
&mut self,
column_name: String,
normaliser: NormaliserType
) -> Result<(), SurrealError>
pub fn add_normaliser( &mut self, column_name: String, normaliser: NormaliserType ) -> Result<(), SurrealError>
Adds a normaliser to the self.normalisers
field.
§Arguments
column_name
- The name of the column to which the normaliser will be applied.normaliser
- The normaliser to be applied to the column.
sourcepub fn get_normaliser(
&self,
column_name: &String
) -> Result<Option<&NormaliserType>, SurrealError>
pub fn get_normaliser( &self, column_name: &String ) -> Result<Option<&NormaliserType>, SurrealError>
sourcepub fn add_output(
&mut self,
column_name: String,
normaliser: Option<NormaliserType>
)
pub fn add_output( &mut self, column_name: String, normaliser: Option<NormaliserType> )
Adds an output column to the self.output
field.
§Arguments
column_name
- The name of the column to be added.normaliser
- The normaliser to be applied to the column.
sourcepub fn add_engine(&mut self, engine: String)
pub fn add_engine(&mut self, engine: String)
sourcepub fn add_origin(&mut self, origin: String) -> Result<(), SurrealError>
pub fn add_origin(&mut self, origin: String) -> Result<(), SurrealError>
sourcepub fn from_bytes(data: Vec<u8>) -> Result<Self, SurrealError>
pub fn from_bytes(data: Vec<u8>) -> Result<Self, SurrealError>
Trait Implementations§
source§impl PartialEq for Header
impl PartialEq for Header
impl StructuralPartialEq for Header
Auto Trait Implementations§
impl Freeze for Header
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnwindSafe for Header
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