pub struct TrainingExample {
pub embedding: Vec<f32>,
pub activations: Option<Vec<f32>>,
pub attention: Option<Vec<f32>>,
pub quality: f32,
pub reward: Option<f32>,
pub route: Option<String>,
pub context: Vec<String>,
pub weight: f32,
pub tags: Vec<String>,
}Expand description
Training example with all data needed for learning
Fields§
§embedding: Vec<f32>Input embedding
activations: Option<Vec<f32>>Hidden activations (optional, defaults to embedding)
attention: Option<Vec<f32>>Attention weights (optional)
quality: f32Quality score [0.0, 1.0]
reward: Option<f32>Reward signal (optional, defaults to quality)
route: Option<String>Model route identifier
context: Vec<String>Context identifiers
weight: f32Example weight for importance sampling
Tags for filtering
Implementations§
Source§impl TrainingExample
impl TrainingExample
Sourcepub fn with_activations(self, activations: Vec<f32>) -> Self
pub fn with_activations(self, activations: Vec<f32>) -> Self
Set activations
Sourcepub fn with_attention(self, attention: Vec<f32>) -> Self
pub fn with_attention(self, attention: Vec<f32>) -> Self
Set attention
Sourcepub fn with_reward(self, reward: f32) -> Self
pub fn with_reward(self, reward: f32) -> Self
Set reward
Sourcepub fn with_route(self, route: impl Into<String>) -> Self
pub fn with_route(self, route: impl Into<String>) -> Self
Set route
Sourcepub fn with_context(self, ctx: impl Into<String>) -> Self
pub fn with_context(self, ctx: impl Into<String>) -> Self
Add context
Sourcepub fn with_weight(self, weight: f32) -> Self
pub fn with_weight(self, weight: f32) -> Self
Set weight
Sourcepub fn get_activations(&self) -> Vec<f32>
pub fn get_activations(&self) -> Vec<f32>
Get activations or default to embedding
Sourcepub fn get_attention(&self) -> Vec<f32>
pub fn get_attention(&self) -> Vec<f32>
Get attention or default
Sourcepub fn get_reward(&self) -> f32
pub fn get_reward(&self) -> f32
Get reward or default to quality
Trait Implementations§
Source§impl Clone for TrainingExample
impl Clone for TrainingExample
Source§fn clone(&self) -> TrainingExample
fn clone(&self) -> TrainingExample
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TrainingExample
impl Debug for TrainingExample
Source§impl<'de> Deserialize<'de> for TrainingExample
impl<'de> Deserialize<'de> for TrainingExample
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TrainingExample
impl RefUnwindSafe for TrainingExample
impl Send for TrainingExample
impl Sync for TrainingExample
impl Unpin for TrainingExample
impl UnwindSafe for TrainingExample
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