Skip to main content

spawn_train_worker

Function spawn_train_worker 

Source
pub(crate) fn spawn_train_worker() -> (Sender<Vec<TreeSample>>, Receiver<Result<TrainResult, Error>>)
Expand description

Spawn the training worker and return its job and result channels.

The worker owns no scheduler state. It receives a snapshot of the window (the window is only mutated by the ingest on the main thread, so handing over a snapshot cannot race with the ingest), fits the tree and computes the holdout metrics, and sends the result back. The publish stays on the main thread. Dropping the job sender closes the channel and the worker exits on its next recv().