pub struct MetaLearner {
pub id: Uuid,
pub name: String,
pub meta_params: Vec<f32>,
pub strategies: Vec<LearningStrategy>,
pub task_embeddings: HashMap<String, Vec<f32>>,
pub meta_lr: f32,
pub inner_lr: f32,
pub task_count: u64,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Expand description
Meta-learner that learns how to learn.
Maintains initialization parameters that enable fast adaptation to new tasks (inspired by MAML/Reptile).
Fields§
§id: UuidUnique identifier.
name: StringName/description.
meta_params: Vec<f32>Meta-parameters (good initialization for fast adaptation).
strategies: Vec<LearningStrategy>Learning strategies discovered.
task_embeddings: HashMap<String, Vec<f32>>Task embeddings for similarity.
meta_lr: f32Meta-learning rate (outer loop).
inner_lr: f32Inner loop learning rate.
task_count: u64Number of tasks learned.
created_at: DateTime<Utc>When created.
updated_at: DateTime<Utc>When last updated.
Implementations§
Source§impl MetaLearner
impl MetaLearner
Sourcepub fn with_meta_lr(self, lr: f32) -> Self
pub fn with_meta_lr(self, lr: f32) -> Self
Set meta learning rate.
Sourcepub fn with_inner_lr(self, lr: f32) -> Self
pub fn with_inner_lr(self, lr: f32) -> Self
Set inner learning rate.
Sourcepub fn initialize_for_task(&self, task_embedding: Option<&[f32]>) -> Vec<f32>
pub fn initialize_for_task(&self, task_embedding: Option<&[f32]>) -> Vec<f32>
Get initialization parameters for a new task.
Uses meta-params as starting point, potentially adjusted based on task similarity.
Sourcepub fn meta_update(
&mut self,
task_id: &str,
final_params: &[f32],
task_embedding: Option<Vec<f32>>,
)
pub fn meta_update( &mut self, task_id: &str, final_params: &[f32], task_embedding: Option<Vec<f32>>, )
Meta-update after completing a task (Reptile-style).
Updates meta-params to be a better initialization for future tasks.
Sourcepub fn register_strategy(&mut self, strategy: LearningStrategy)
pub fn register_strategy(&mut self, strategy: LearningStrategy)
Register a learning strategy that worked well.
Sourcepub fn select_strategy(
&self,
task_features: &TaskFeatures,
) -> Option<&LearningStrategy>
pub fn select_strategy( &self, task_features: &TaskFeatures, ) -> Option<&LearningStrategy>
Select best strategy for a new task.
Sourcepub fn num_strategies(&self) -> usize
pub fn num_strategies(&self) -> usize
Get number of strategies.
Trait Implementations§
Source§impl Clone for MetaLearner
impl Clone for MetaLearner
Source§fn clone(&self) -> MetaLearner
fn clone(&self) -> MetaLearner
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MetaLearner
impl Debug for MetaLearner
Source§impl<'de> Deserialize<'de> for MetaLearner
impl<'de> Deserialize<'de> for MetaLearner
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 MetaLearner
impl RefUnwindSafe for MetaLearner
impl Send for MetaLearner
impl Sync for MetaLearner
impl Unpin for MetaLearner
impl UnsafeUnpin for MetaLearner
impl UnwindSafe for MetaLearner
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request