pub enum GenerationStrategy {
Template,
EDA,
BackTranslation,
MixUp,
GrammarBased,
SelfTraining,
WeakSupervision,
}Expand description
Available synthetic data generation strategies.
Each strategy uses different techniques for creating synthetic samples, with trade-offs between quality, diversity, and computational cost.
§Example
use aprender::synthetic::GenerationStrategy;
let strategy = GenerationStrategy::EDA;
assert_eq!(strategy.name(), "eda");
assert!(strategy.description().contains("Augmentation"));§References
- Template: Cubuk et al. (2019).
AutoAugment. CVPR. - EDA: Wei & Zou (2019). Easy Data Augmentation. EMNLP.
BackTranslation: Sennrich et al. (2016). Back-translation. ACL.MixUp: Zhang et al. (2018).MixUp. ICLR.GrammarBased: Jia & Liang (2016). Data Recombination. ACL.SelfTraining: Xie et al. (2020). Noisy Student. CVPR.WeakSupervision: Ratner et al. (2017). Snorkel. VLDB.
Variants§
Template
Template-based generation with slot filling.
Uses parameterized templates to generate variations by filling slots with different values. Fast and controllable, but limited diversity.
EDA
Easy Data Augmentation (synonym replacement, random insertion/swap/deletion).
Simple text transformations that preserve semantics while creating surface-level variations. Good baseline with low computational cost.
BackTranslation
Back-translation through pivot representation.
Translates to intermediate representation and back, creating paraphrases. High quality but requires translation models or intermediate formats.
MixUp
MixUp interpolation in embedding space.
Creates virtual examples by interpolating between existing samples in latent space. Improves generalization and decision boundaries.
GrammarBased
Grammar-based recombination from rules.
Uses formal grammar to generate valid samples by recombining syntactic components. Guarantees syntactic correctness.
SelfTraining
Self-training with pseudo-labels.
Uses model predictions on unlabeled data as synthetic labels. Iteratively improves with curriculum ordering.
WeakSupervision
Programmatic weak supervision with labeling functions.
Uses heuristic rules to label unlabeled data, then combines noisy labels using a generative model.
Implementations§
Source§impl GenerationStrategy
impl GenerationStrategy
Sourcepub fn description(&self) -> &'static str
pub fn description(&self) -> &'static str
Get a human-readable description of the strategy.
Sourcepub fn computational_cost(&self) -> u8
pub fn computational_cost(&self) -> u8
Get the relative computational cost (1 = lowest, 5 = highest).
Sourcepub fn requires_model(&self) -> bool
pub fn requires_model(&self) -> bool
Check if this strategy requires a trained model.
Sourcepub fn preserves_labels(&self) -> bool
pub fn preserves_labels(&self) -> bool
Check if this strategy preserves label semantics.
Sourcepub fn all() -> &'static [GenerationStrategy]
pub fn all() -> &'static [GenerationStrategy]
Get all available strategies.
Trait Implementations§
Source§impl Clone for GenerationStrategy
impl Clone for GenerationStrategy
Source§fn clone(&self) -> GenerationStrategy
fn clone(&self) -> GenerationStrategy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GenerationStrategy
impl Debug for GenerationStrategy
Source§impl Default for GenerationStrategy
impl Default for GenerationStrategy
Source§impl Display for GenerationStrategy
impl Display for GenerationStrategy
Source§impl Hash for GenerationStrategy
impl Hash for GenerationStrategy
Source§impl PartialEq for GenerationStrategy
impl PartialEq for GenerationStrategy
impl Copy for GenerationStrategy
impl Eq for GenerationStrategy
impl StructuralPartialEq for GenerationStrategy
Auto Trait Implementations§
impl Freeze for GenerationStrategy
impl RefUnwindSafe for GenerationStrategy
impl Send for GenerationStrategy
impl Sync for GenerationStrategy
impl Unpin for GenerationStrategy
impl UnwindSafe for GenerationStrategy
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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