pub struct TrainingDataset {
pub data: Vec<TrainingData>,
}Expand description
Training dataset manager
Fields§
§data: Vec<TrainingData>Implementations§
Source§impl TrainingDataset
impl TrainingDataset
pub fn new() -> Self
Sourcepub fn load_from_pgn<P: AsRef<Path>>(
&mut self,
path: P,
max_games: Option<usize>,
max_moves_per_game: usize,
) -> Result<(), Box<dyn Error>>
pub fn load_from_pgn<P: AsRef<Path>>( &mut self, path: P, max_games: Option<usize>, max_moves_per_game: usize, ) -> Result<(), Box<dyn Error>>
Load positions from a PGN file with parallel processing
Sourcepub fn evaluate_with_external_engine(
&mut self,
depth: u8,
) -> Result<(), Box<dyn Error>>
pub fn evaluate_with_external_engine( &mut self, depth: u8, ) -> Result<(), Box<dyn Error>>
Evaluate all positions using external engine
Sourcepub fn evaluate_with_external_engine_parallel(
&mut self,
depth: u8,
num_threads: usize,
) -> Result<(), Box<dyn Error>>
pub fn evaluate_with_external_engine_parallel( &mut self, depth: u8, num_threads: usize, ) -> Result<(), Box<dyn Error>>
Evaluate all positions using external engine in parallel
Sourcepub fn train_engine(&self, engine: &mut ChessVectorEngine)
pub fn train_engine(&self, engine: &mut ChessVectorEngine)
Train the vector engine with this dataset
Sourcepub fn split(&self, train_ratio: f32) -> (TrainingDataset, TrainingDataset)
pub fn split(&self, train_ratio: f32) -> (TrainingDataset, TrainingDataset)
Split dataset into train/test sets by games to prevent data leakage
Sourcepub fn load_and_append<P: AsRef<Path>>(
&mut self,
path: P,
) -> Result<(), Box<dyn Error>>
pub fn load_and_append<P: AsRef<Path>>( &mut self, path: P, ) -> Result<(), Box<dyn Error>>
Load and append data from file to existing dataset (incremental training)
Sourcepub fn merge(&mut self, other: TrainingDataset)
pub fn merge(&mut self, other: TrainingDataset)
Merge another dataset into this one
Sourcepub fn save_incremental<P: AsRef<Path>>(
&self,
path: P,
) -> Result<(), Box<dyn Error>>
pub fn save_incremental<P: AsRef<Path>>( &self, path: P, ) -> Result<(), Box<dyn Error>>
Save incrementally (append to existing file if it exists)
Sourcepub fn save_incremental_with_options<P: AsRef<Path>>(
&self,
path: P,
deduplicate: bool,
) -> Result<(), Box<dyn Error>>
pub fn save_incremental_with_options<P: AsRef<Path>>( &self, path: P, deduplicate: bool, ) -> Result<(), Box<dyn Error>>
Save incrementally with option to skip deduplication
Sourcepub fn save_append_only<P: AsRef<Path>>(
&self,
path: P,
) -> Result<(), Box<dyn Error>>
pub fn save_append_only<P: AsRef<Path>>( &self, path: P, ) -> Result<(), Box<dyn Error>>
Fast append-only save (no deduplication, just append new positions)
Sourcepub fn add_position(
&mut self,
board: Board,
evaluation: f32,
depth: u8,
game_id: usize,
)
pub fn add_position( &mut self, board: Board, evaluation: f32, depth: u8, game_id: usize, )
Add a single training data point
Sourcepub fn next_game_id(&self) -> usize
pub fn next_game_id(&self) -> usize
Get the next available game ID for incremental training
Sourcepub fn deduplicate(&mut self, similarity_threshold: f32)
pub fn deduplicate(&mut self, similarity_threshold: f32)
Remove near-duplicate positions to reduce overfitting
Sourcepub fn deduplicate_fast(&mut self)
pub fn deduplicate_fast(&mut self)
Fast hash-based deduplication for exact duplicates (O(n))
Sourcepub fn merge_and_deduplicate(&mut self, new_data: Vec<TrainingData>)
pub fn merge_and_deduplicate(&mut self, new_data: Vec<TrainingData>)
Streaming deduplication when merging with existing data (faster for large datasets)
Sourcepub fn deduplicate_parallel(
&mut self,
similarity_threshold: f32,
chunk_size: usize,
)
pub fn deduplicate_parallel( &mut self, similarity_threshold: f32, chunk_size: usize, )
Remove near-duplicate positions using parallel comparison (faster for large datasets)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TrainingDataset
impl RefUnwindSafe for TrainingDataset
impl Send for TrainingDataset
impl Sync for TrainingDataset
impl Unpin for TrainingDataset
impl UnwindSafe for TrainingDataset
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> 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> 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