pub struct LegacyModelTrainer { /* private fields */ }Expand description
Model trainer for bug prediction
Implementations§
Source§impl ModelTrainer
impl ModelTrainer
Sourcepub fn with_config(config: TrainingConfig) -> Self
pub fn with_config(config: TrainingConfig) -> Self
Create trainer with custom configuration
Sourcepub fn train_ratio(self, ratio: f64) -> Self
pub fn train_ratio(self, ratio: f64) -> Self
Set train/test split ratio
Sourcepub fn train_test_split(
&self,
features: &[CodeFeatures],
labels: &[bool],
) -> (Vec<CodeFeatures>, Vec<bool>, Vec<CodeFeatures>, Vec<bool>)
pub fn train_test_split( &self, features: &[CodeFeatures], labels: &[bool], ) -> (Vec<CodeFeatures>, Vec<bool>, Vec<CodeFeatures>, Vec<bool>)
Split data into train and test sets with stratification
Sourcepub fn cross_validate(
&self,
features: &[CodeFeatures],
labels: &[bool],
) -> Result<Vec<ModelMetrics>>
pub fn cross_validate( &self, features: &[CodeFeatures], labels: &[bool], ) -> Result<Vec<ModelMetrics>>
Sourcepub fn train(
&self,
features: &[CodeFeatures],
labels: &[bool],
) -> Result<TrainingResult>
pub fn train( &self, features: &[CodeFeatures], labels: &[bool], ) -> Result<TrainingResult>
Full training pipeline: split, train, cross-validate, evaluate
§Errors
Returns error if training or evaluation fails.
Trait Implementations§
Source§impl Debug for ModelTrainer
impl Debug for ModelTrainer
Auto Trait Implementations§
impl Freeze for ModelTrainer
impl RefUnwindSafe for ModelTrainer
impl Send for ModelTrainer
impl Sync for ModelTrainer
impl Unpin for ModelTrainer
impl UnsafeUnpin for ModelTrainer
impl UnwindSafe for ModelTrainer
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