pub struct PretrainedModel {
pub model: Box<dyn PipelinePredictor>,
pub frozen_layers: Vec<String>,
pub trainable_layers: Vec<String>,
pub metadata: HashMap<String, String>,
}Expand description
Pre-trained model wrapper for transfer learning
Fields§
§model: Box<dyn PipelinePredictor>The pre-trained model
frozen_layers: Vec<String>Feature extraction layers (frozen)
trainable_layers: Vec<String>Fine-tuning layers (trainable)
metadata: HashMap<String, String>Model metadata
Implementations§
Source§impl PretrainedModel
impl PretrainedModel
Sourcepub fn new(model: Box<dyn PipelinePredictor>) -> Self
pub fn new(model: Box<dyn PipelinePredictor>) -> Self
Create a new pre-trained model wrapper
Sourcepub fn with_frozen_layers(self, layers: Vec<String>) -> Self
pub fn with_frozen_layers(self, layers: Vec<String>) -> Self
Add frozen layers
Sourcepub fn with_trainable_layers(self, layers: Vec<String>) -> Self
pub fn with_trainable_layers(self, layers: Vec<String>) -> Self
Add trainable layers
Sourcepub fn with_metadata(self, metadata: HashMap<String, String>) -> Self
pub fn with_metadata(self, metadata: HashMap<String, String>) -> Self
Add metadata
Sourcepub fn extract_features(
&self,
x: &ArrayView2<'_, Float>,
) -> SklResult<Array2<f64>>
pub fn extract_features( &self, x: &ArrayView2<'_, Float>, ) -> SklResult<Array2<f64>>
Extract features using frozen layers
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PretrainedModel
impl !RefUnwindSafe for PretrainedModel
impl Send for PretrainedModel
impl Sync for PretrainedModel
impl Unpin for PretrainedModel
impl !UnwindSafe for PretrainedModel
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
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>
Converts
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>
Converts
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